diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json index eacd18cb3..95c4ac18e 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -451,8 +451,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -473,8 +476,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -930,8 +936,11 @@ "label" : "count", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -984,8 +993,11 @@ "isStatic" : false, "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1053,8 +1065,11 @@ "label" : "zipCode", "name" : "zipCode", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1090,8 +1105,11 @@ "isStatic" : false, "name" : "zipCode", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1280,8 +1298,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1308,8 +1329,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1330,8 +1354,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1341,8 +1368,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1362,8 +1392,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1656,8 +1689,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1688,8 +1724,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1714,8 +1753,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1729,8 +1771,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1854,8 +1899,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1887,8 +1935,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1914,8 +1965,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1930,8 +1984,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -2060,8 +2117,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2093,8 +2153,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2119,8 +2182,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2146,8 +2212,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2162,8 +2231,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2199,8 +2271,11 @@ "associatedValues" : [ { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2286,8 +2361,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2331,8 +2409,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -2390,15 +2471,21 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -2504,8 +2591,11 @@ "isStatic" : false, "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -2573,8 +2663,11 @@ "isStatic" : false, "name" : "zipCode", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2602,8 +2695,11 @@ "isStatic" : false, "name" : "age", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -2646,8 +2742,11 @@ "isStatic" : false, "name" : "id", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json index 3046e1f01..60eb694ff 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json @@ -147,8 +147,11 @@ "isStatic" : false, "name" : "startLine", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -157,8 +160,11 @@ "isStatic" : false, "name" : "startColumn", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -167,8 +173,11 @@ "isStatic" : false, "name" : "endLine", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -177,8 +186,11 @@ "isStatic" : false, "name" : "endColumn", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index eab3a0831..5b6c7d1ff 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -748,7 +748,7 @@ struct StackCodegen { /// - Returns: An ExprSyntax representing the lift expression func liftExpression(for type: BridgeType) -> ExprSyntax { switch type { - case .string, .int, .uint, .bool, .float, .double, + case .string, .integer, .bool, .float, .double, .jsObject(nil), .jsValue, .swiftStruct, .swiftHeapObject, .unsafePointer, .swiftProtocol, .caseEnum, .associatedValueEnum, .rawValueEnum, .array, .dictionary: return "\(raw: type.swiftType).bridgeJSStackPop()" @@ -766,7 +766,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), .jsValue, + case .string, .integer, .bool, .float, .double, .jsObject(nil), .jsValue, .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum, .array, .dictionary: return "\(raw: typeName)<\(raw: wrappedType.swiftType)>.bridgeJSStackPop()" @@ -789,7 +789,7 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch type { - case .string, .int, .uint, .bool, .float, .double, .jsValue, + case .string, .integer, .bool, .float, .double, .jsValue, .jsObject(nil), .swiftHeapObject, .unsafePointer, .closure, .caseEnum, .rawValueEnum, .associatedValueEnum, .swiftStruct, .nullable: return ["\(raw: accessor).bridgeJSStackPush()"] @@ -1425,8 +1425,7 @@ extension BridgeType { var swiftType: String { switch self { case .bool: return "Bool" - case .int: return "Int" - case .uint: return "UInt" + case .integer(let t): return t.swiftTypeName case .float: return "Float" case .double: return "Double" case .string: return "String" @@ -1502,7 +1501,7 @@ extension BridgeType { func liftParameterInfo() throws -> LiftingIntrinsicInfo { switch self { case .bool: return .bool - case .int, .uint: return .int + case .integer(let t): return LiftingIntrinsicInfo(parameters: [("value", t.wasmCoreType)]) case .float: return .float case .double: return .double case .string: return .string @@ -1560,7 +1559,7 @@ extension BridgeType { func loweringReturnInfo() throws -> LoweringIntrinsicInfo { switch self { case .bool: return .bool - case .int, .uint: return .int + case .integer(let t): return LoweringIntrinsicInfo(returnType: t.wasmCoreType) case .float: return .float case .double: return .double case .string: return .string @@ -1592,7 +1591,8 @@ extension SwiftEnumRawType { var liftingIntrinsicInfo: BridgeType.LiftingIntrinsicInfo { switch self { case .bool: return .bool - case .int, .int32, .int64, .uint, .uint32, .uint64: return .int + case .integer(let integerType): + return .init(parameters: [("value", integerType.wasmCoreType)]) case .float: return .float case .double: return .double case .string: return .string @@ -1602,7 +1602,8 @@ extension SwiftEnumRawType { var loweringIntrinsicInfo: BridgeType.LoweringIntrinsicInfo { switch self { case .bool: return .bool - case .int, .int32, .int64, .uint, .uint32, .uint64: return .int + case .integer(let integerType): + return .init(returnType: integerType.wasmCoreType) 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 7d9a6f087..1d1fe3aa9 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -822,7 +822,7 @@ extension BridgeType { func loweringParameterInfo(context: BridgeContext = .importTS) throws -> LoweringParameterInfo { switch self { case .bool: return .bool - case .int, .uint: return .int + case .integer(let t): return LoweringParameterInfo(loweredParameters: [("value", t.wasmCoreType)]) case .float: return .float case .double: return .double case .string: return .string @@ -901,7 +901,7 @@ extension BridgeType { ) throws -> LiftingReturnInfo { switch self { case .bool: return .bool - case .int, .uint: return .int + case .integer(let t): return LiftingReturnInfo(valueToLift: t.wasmCoreType) case .float: return .float case .double: return .double case .string: return .string diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 8f1b3fa35..81ad32813 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -442,7 +442,7 @@ public final class SwiftToSkeleton { } private enum ExportSwiftConstants { - static let supportedRawTypes = SwiftEnumRawType.allCases.map { $0.rawValue } + static let supportedRawTypes = SwiftEnumRawType.supportedTypeNames } extension AttributeSyntax { @@ -828,7 +828,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { let intValue = Int(intLiteral.literal.text) { let value = DefaultValue.int(isNegative ? -intValue : intValue) - if let type = type, !type.isCompatibleWith(.int) { + if let type = type, !type.isCompatibleWith(.integer(.int)) { return nil } return value @@ -1489,12 +1489,12 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { for enumCase in exportedEnum.cases { for associatedValue in enumCase.associatedValues { switch associatedValue.type { - case .string, .int, .float, .double, .bool, .caseEnum, .rawValueEnum, + case .string, .integer, .float, .double, .bool, .caseEnum, .rawValueEnum, .swiftStruct, .swiftHeapObject, .jsObject, .associatedValueEnum, .array: break case .nullable(let wrappedType, _): switch wrappedType { - case .string, .int, .float, .double, .bool, .caseEnum, .rawValueEnum, + case .string, .integer, .float, .double, .bool, .caseEnum, .rawValueEnum, .swiftStruct, .swiftHeapObject, .jsObject, .associatedValueEnum, .array: break default: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 8c18ced4d..f69a4b266 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -302,6 +302,7 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject);", "let \(JSGlueVariableScope.reservedStringStack) = [];", "let \(JSGlueVariableScope.reservedI32Stack) = [];", + "let \(JSGlueVariableScope.reservedI64Stack) = [];", "let \(JSGlueVariableScope.reservedF32Stack) = [];", "let \(JSGlueVariableScope.reservedF64Stack) = [];", "let \(JSGlueVariableScope.reservedPointerStack) = [];", @@ -437,6 +438,16 @@ public struct BridgeJSLink { printer.write("return \(JSGlueVariableScope.reservedPointerStack).pop();") } printer.write("}") + printer.write("bjs[\"swift_js_push_i64\"] = function(v) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedI64Stack).push(v);") + } + printer.write("}") + printer.write("bjs[\"swift_js_pop_i64\"] = function() {") + printer.indent { + printer.write("return \(JSGlueVariableScope.reservedI64Stack).pop();") + } + printer.write("}") if !allStructs.isEmpty { for structDef in allStructs { printer.write("bjs[\"swift_js_struct_lower_\(structDef.abiName)\"] = function(objectId) {") @@ -3508,8 +3519,8 @@ extension BridgeType { return "void" case .string: return "string" - case .int, .uint: - return "number" + case .integer(let t): + return t.tsTypeName case .float: return "number" case .double: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index bec5ce3e9..599b6df39 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -26,6 +26,7 @@ final class JSGlueVariableScope { static let reservedTextDecoder = "textDecoder" static let reservedStringStack = "strStack" static let reservedI32Stack = "i32Stack" + static let reservedI64Stack = "i64Stack" static let reservedF32Stack = "f32Stack" static let reservedF64Stack = "f64Stack" static let reservedPointerStack = "ptrStack" @@ -54,6 +55,7 @@ final class JSGlueVariableScope { reservedTextDecoder, reservedStringStack, reservedI32Stack, + reservedI64Stack, reservedF32Stack, reservedF64Stack, reservedPointerStack, @@ -100,6 +102,9 @@ extension JSGlueVariableScope { func emitPushI32Parameter(_ value: String, printer: CodeFragmentPrinter) { printer.write("\(JSGlueVariableScope.reservedI32Stack).push(\(value));") } + func emitPushI64Parameter(_ value: String, printer: CodeFragmentPrinter) { + printer.write("\(JSGlueVariableScope.reservedI64Stack).push(\(value));") + } func emitPushF64Parameter(_ value: String, printer: CodeFragmentPrinter) { printer.write("\(JSGlueVariableScope.reservedF64Stack).push(\(value));") } @@ -117,6 +122,9 @@ extension JSGlueVariableScope { func popI32() -> String { return "\(JSGlueVariableScope.reservedI32Stack).pop()" } + func popI64() -> String { + return "\(JSGlueVariableScope.reservedI64Stack).pop()" + } func popF64() -> String { return "\(JSGlueVariableScope.reservedF64Stack).pop()" } @@ -238,6 +246,14 @@ struct IntrinsicJSFragment: Sendable { ) static let uintLiftParameter = uintLiftReturn + static let uint64LiftReturn = IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, _ in + return ["BigInt.asUintN(64, \(arguments[0]))"] + } + ) + static let uint64LiftParameter = uint64LiftReturn + // MARK: - String Fragments static let stringLowerParameter = IntrinsicJSFragment( @@ -650,7 +666,12 @@ struct IntrinsicJSFragment: Sendable { ) } - let innerFragment = try liftParameter(type: wrappedType, context: bridgeContext) + let innerFragment = + if wrappedType.optionalConvention == .stackABI { + try stackLiftFragment(elementType: wrappedType) + } else { + try liftParameter(type: wrappedType, context: bridgeContext) + } return compositeOptionalLiftParameter( wrappedType: wrappedType, kind: kind, @@ -738,7 +759,12 @@ struct IntrinsicJSFragment: Sendable { ) } - let innerFragment = try lowerParameter(type: wrappedType) + let innerFragment = + if wrappedType.optionalConvention == .stackABI { + try stackLowerFragment(elementType: wrappedType) + } else { + try lowerParameter(type: wrappedType) + } return try compositeOptionalLowerParameter( wrappedType: wrappedType, kind: kind, @@ -832,7 +858,12 @@ struct IntrinsicJSFragment: Sendable { let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(scope.popI32());") - let innerFragment = try liftReturn(type: wrappedType) + let innerFragment = + if wrappedType.optionalConvention == .stackABI { + try stackLiftFragment(elementType: wrappedType) + } else { + try liftReturn(type: wrappedType) + } let innerPrinter = CodeFragmentPrinter() let innerResults = try innerFragment.printCode([], context.with(\.printer, innerPrinter)) @@ -1077,6 +1108,15 @@ struct IntrinsicJSFragment: Sendable { return optionalLowerReturnToSideChannel(mode: mode, kind: kind) } + if wrappedType.optionalConvention == .stackABI { + let innerFragment = try stackLowerFragment(elementType: wrappedType) + return stackOptionalLower( + wrappedType: wrappedType, + kind: kind, + innerFragment: innerFragment + ) + } + if wrappedType.nilSentinel.hasSentinel { let innerFragment = try lowerReturn(type: wrappedType, context: .exportSwift) return sentinelOptionalLowerReturn( @@ -1183,10 +1223,10 @@ struct IntrinsicJSFragment: Sendable { private static func popExpression(for wasmType: WasmCoreType, scope: JSGlueVariableScope) -> String { switch wasmType { case .i32: return scope.popI32() + case .i64: return scope.popI64() case .f32: return scope.popF32() case .f64: return scope.popF64() case .pointer: return scope.popPointer() - case .i64: return scope.popI32() } } @@ -1198,10 +1238,10 @@ struct IntrinsicJSFragment: Sendable { ) { switch wasmType { case .i32: scope.emitPushI32Parameter(value, printer: printer) + case .i64: scope.emitPushI64Parameter(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) } } @@ -1243,7 +1283,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 .bool, .int, .uint, .float, .double, .unsafePointer, .caseEnum: + case .bool, .integer, .float, .double, .unsafePointer, .caseEnum: return .identity case .rawValueEnum(_, let rawType) where rawType != .string: return .identity @@ -1291,9 +1331,19 @@ struct IntrinsicJSFragment: Sendable { switch type { case .bool, .rawValueEnum(_, .bool): return .boolLiftReturn - case .uint: + case .integer(let t) where !t.is64Bit && !t.isSigned: + return .uintLiftReturn + case .integer(let t) where t.is64Bit && !t.isSigned: + return .uint64LiftReturn + case .rawValueEnum(_, let rawType) + where rawType.integerType?.is64Bit == false + && rawType.integerType?.isSigned == false: return .uintLiftReturn - case .int, .float, .double, .unsafePointer, .caseEnum: + case .rawValueEnum(_, let rawType) + where rawType.integerType?.is64Bit == true + && rawType.integerType?.isSigned == false: + return .uint64LiftReturn + case .integer, .float, .double, .unsafePointer, .caseEnum: return .identity case .rawValueEnum(_, let rawType) where rawType != .string && rawType != .bool: return .identity @@ -1340,9 +1390,19 @@ struct IntrinsicJSFragment: Sendable { switch type { case .bool, .rawValueEnum(_, .bool): return .boolLiftParameter - case .uint: + case .integer(let t) where !t.is64Bit && !t.isSigned: + return .uintLiftParameter + case .integer(let t) where t.is64Bit && !t.isSigned: + return .uint64LiftParameter + case .rawValueEnum(_, let rawType) + where rawType.integerType?.is64Bit == false + && rawType.integerType?.isSigned == false: return .uintLiftParameter - case .int, .float, .double, .unsafePointer, .caseEnum: + case .rawValueEnum(_, let rawType) + where rawType.integerType?.is64Bit == true + && rawType.integerType?.isSigned == false: + return .uint64LiftParameter + case .integer, .float, .double, .unsafePointer, .caseEnum: return .identity case .rawValueEnum(_, let rawType) where rawType != .string && rawType != .bool: return .identity @@ -1426,7 +1486,7 @@ struct IntrinsicJSFragment: Sendable { switch type { case .bool, .rawValueEnum(_, .bool): return .boolLowerReturn - case .int, .uint, .float, .double, .unsafePointer, .caseEnum: + case .integer, .float, .double, .unsafePointer, .caseEnum: return .identity case .rawValueEnum(_, let rawType) where rawType != .string && rawType != .bool: return .identity @@ -2577,8 +2637,10 @@ private extension BridgeType { switch self { case .bool: return .inlineFlag - case .int, .uint: + case .integer(let t) where !t.is64Bit: return .sideChannelReturn(.none) + case .integer: + return .stackABI case .float: return .sideChannelReturn(.none) case .double: @@ -2605,7 +2667,9 @@ private extension BridgeType { return .sideChannelReturn(.none) case .bool: return .inlineFlag - case .int, .int32, .int64, .uint, .uint32, .uint64: + case .integer(let integerType) where integerType.is64Bit: + return .stackABI + case .integer: return .sideChannelReturn(.none) } case .associatedValueEnum: @@ -2637,9 +2701,10 @@ private extension BridgeType { 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): + case .integer(let t) where !t.is64Bit: return .int + case .caseEnum: + return .int + case .rawValueEnum(_, let rawType) where rawType.integerType?.is64Bit == false: return .int case .float, .rawValueEnum(_, .float): return .float case .double, .rawValueEnum(_, .double): return .double @@ -2650,8 +2715,10 @@ private extension BridgeType { var wasmParams: [(name: String, type: WasmCoreType)] { switch self { - case .bool, .int, .uint: + case .bool: return [("value", .i32)] + case .integer(let t): + return [("value", t.wasmCoreType)] case .float: return [("value", .f32)] case .double: @@ -2678,8 +2745,10 @@ private extension BridgeType { return [("value", .f32)] case .double: return [("value", .f64)] - case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: + case .bool: return [("value", .i32)] + case .integer(let integerType): + return [("value", integerType.wasmCoreType)] } case .associatedValueEnum: return [("caseId", .i32)] @@ -2694,7 +2763,7 @@ private extension BridgeType { var isSingleParamScalar: Bool { switch self { - case .bool, .int, .uint, .float, .double, .unsafePointer, .caseEnum: return true + case .bool, .integer, .float, .double, .unsafePointer, .caseEnum: return true case .rawValueEnum(_, let rawType): return rawType != .string default: return false } @@ -2703,9 +2772,11 @@ private extension BridgeType { 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): + case .integer(let t) where !t.is64Bit: return "($0 | 0)" + case .integer: return nil // 64-bit integers pass through directly + case .unsafePointer, .caseEnum: + return "($0 | 0)" + case .rawValueEnum(_, let rawType) where rawType.integerType?.is64Bit == false: return "($0 | 0)" case .float, .rawValueEnum(_, .float): return "Math.fround($0)" case .double, .rawValueEnum(_, .double): return nil @@ -2716,7 +2787,11 @@ private extension BridgeType { var liftCoerce: String? { switch self { case .bool, .rawValueEnum(_, .bool): return "$0 !== 0" - case .uint: return "$0 >>> 0" + case .integer(let t) where !t.is64Bit && !t.isSigned: return "$0 >>> 0" + case .rawValueEnum(_, let rawType) + where rawType.integerType?.is64Bit == false + && rawType.integerType?.isSigned == false: + return "$0 >>> 0" default: return nil } } @@ -2731,7 +2806,7 @@ private extension BridgeType { var varHint: String { switch self { case .bool: return "bool" - case .int, .uint: return "int" + case .integer: return "int" case .float: return "f32" case .double: return "f64" case .unsafePointer: return "pointer" diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 967215f6c..1f03e09ba 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -164,8 +164,65 @@ public enum JSOptionalKind: String, Codable, Equatable, Hashable, Sendable { } } +public enum IntegerWidth: String, Codable, Equatable, Hashable, Sendable { + case word // Int / UInt (ptr-sized, 32-bit on wasm32) + case w8, w16, w32, w64 +} + +public struct BridgeIntegerType: Codable, Equatable, Hashable, Sendable { + public let width: IntegerWidth + public let isSigned: Bool + + public static let int = BridgeIntegerType(width: .word, isSigned: true) + public static let uint = BridgeIntegerType(width: .word, isSigned: false) + public static let int8 = BridgeIntegerType(width: .w8, isSigned: true) + public static let uint8 = BridgeIntegerType(width: .w8, isSigned: false) + public static let int16 = BridgeIntegerType(width: .w16, isSigned: true) + public static let uint16 = BridgeIntegerType(width: .w16, isSigned: false) + public static let int32 = BridgeIntegerType(width: .w32, isSigned: true) + public static let uint32 = BridgeIntegerType(width: .w32, isSigned: false) + public static let int64 = BridgeIntegerType(width: .w64, isSigned: true) + public static let uint64 = BridgeIntegerType(width: .w64, isSigned: false) + + public var is64Bit: Bool { width == .w64 } + public var wasmCoreType: WasmCoreType { is64Bit ? .i64 : .i32 } + + public var swiftTypeName: String { + switch (width, isSigned) { + case (.word, true): return "Int" + case (.word, false): return "UInt" + case (.w8, true): return "Int8" + case (.w8, false): return "UInt8" + case (.w16, true): return "Int16" + case (.w16, false): return "UInt16" + case (.w32, true): return "Int32" + case (.w32, false): return "UInt32" + case (.w64, true): return "Int64" + case (.w64, false): return "UInt64" + } + } + + public var tsTypeName: String { is64Bit ? "bigint" : "number" } + + public var mangleTypeName: String { + switch (width, isSigned) { + case (.word, true): return "Si" + case (.word, false): return "Su" + case (.w8, true): return "s8" + case (.w8, false): return "u8" + case (.w16, true): return "s16" + case (.w16, false): return "u16" + case (.w32, true): return "s32" + case (.w32, false): return "u32" + case (.w64, true): return "s64" + case (.w64, false): return "u64" + } + } +} + public enum BridgeType: Codable, Equatable, Hashable, Sendable { - case int, uint, float, double, string, bool, jsObject(String?), jsValue, swiftHeapObject(String), void + case integer(BridgeIntegerType), float, double, string, bool, jsObject(String?), jsValue, swiftHeapObject(String), + void case unsafePointer(UnsafePointerType) indirect case nullable(BridgeType, JSOptionalKind) indirect case array(BridgeType) @@ -183,26 +240,53 @@ public enum WasmCoreType: String, Codable, Sendable { case i32, i64, f32, f64, pointer } -public enum SwiftEnumRawType: String, CaseIterable, Codable, Sendable { - case string = "String" - case bool = "Bool" - case int = "Int" - case int32 = "Int32" - case int64 = "Int64" - case uint = "UInt" - case uint32 = "UInt32" - case uint64 = "UInt64" - case float = "Float" - case double = "Double" +public enum SwiftEnumRawType: RawRepresentable, Codable, Equatable, Hashable, Sendable { + case string + case bool + case integer(BridgeIntegerType) + case float + case double + + private static let integerTypeMappings: [(name: String, type: BridgeIntegerType)] = [ + ("Int", .int), + ("Int32", .int32), + ("Int64", .int64), + ("UInt", .uint), + ("UInt32", .uint32), + ("UInt64", .uint64), + ] + + public static let supportedTypeNames = + [ + "String", + "Bool", + "Float", + "Double", + ] + integerTypeMappings.map(\.name) + + public var rawValue: String { + switch self { + case .string: + return "String" + case .bool: + return "Bool" + case .integer(let integerType): + return integerType.swiftTypeName + case .float: + return "Float" + case .double: + return "Double" + } + } public var wasmCoreType: WasmCoreType? { switch self { case .string: return nil - case .bool, .int, .int32, .uint, .uint32: + case .bool: return .i32 - case .int64, .uint64: - return .i64 + case .integer(let integerType): + return integerType.wasmCoreType case .float: return .f32 case .double: @@ -210,13 +294,54 @@ public enum SwiftEnumRawType: String, CaseIterable, Codable, Sendable { } } + public var integerType: BridgeIntegerType? { + guard case .integer(let integerType) = self else { + return nil + } + return integerType + } + + public init?(rawValue: String) { + if let integerType = Self.integerTypeMappings.first(where: { $0.name == rawValue })?.type { + self = .integer(integerType) + return + } + switch rawValue { + case "String": + self = .string + case "Bool": + self = .bool + case "Float": + self = .float + case "Double": + self = .double + default: + return nil + } + } + public init?(_ rawTypeString: String?) { - guard let rawTypeString = rawTypeString, - let match = Self.allCases.first(where: { $0.rawValue == rawTypeString }) - else { + guard let rawTypeString else { return nil } - self = match + self.init(rawValue: rawTypeString) + } + + public init(from decoder: any Decoder) throws { + let container = try decoder.singleValueContainer() + let rawValue = try container.decode(String.self) + guard let value = Self(rawValue: rawValue) else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unknown Swift enum raw type: \(rawValue)" + ) + } + self = value + } + + public func encode(to encoder: any Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(rawValue) } } @@ -495,8 +620,10 @@ extension EnumCase { return "\"\(rawValue)\"" case .bool: return rawValue.lowercased() == "true" ? "true" : "false" - case .float, .double, .int, .int32, .int64, .uint, .uint32, .uint64: + case .float, .double: return rawValue + case .integer(let integerType): + return integerType.is64Bit ? "\(rawValue)n" : rawValue } } } @@ -1056,10 +1183,16 @@ 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 "UInt": - self = .uint + case "Int": self = .integer(.int) + case "UInt": self = .integer(.uint) + case "Int8": self = .integer(.int8) + case "UInt8": self = .integer(.uint8) + case "Int16": self = .integer(.int16) + case "UInt16": self = .integer(.uint16) + case "Int32": self = .integer(.int32) + case "UInt32": self = .integer(.uint32) + case "Int64": self = .integer(.int64) + case "UInt64": self = .integer(.uint64) case "Float": self = .float case "Double": @@ -1089,7 +1222,7 @@ extension BridgeType { switch self { case .void: return nil case .bool: return .i32 - case .int, .uint: return .i32 + case .integer(let t): return t.wasmCoreType case .float: return .f32 case .double: return .f64 case .string: return nil @@ -1138,8 +1271,7 @@ extension BridgeType { /// https://github.com/swiftlang/swift/blob/main/docs/ABI/Mangling.rst#types public var mangleTypeName: String { switch self { - case .int: return "Si" - case .uint: return "Su" + case .integer(let t): return t.mangleTypeName case .float: return "Sf" case .double: return "Sd" case .string: return "SS" @@ -1206,12 +1338,14 @@ extension BridgeType { } switch wrappedType { - case .string, .int, .float, .double, .jsObject, .swiftProtocol: + case .string, .integer, .float, .double, .jsObject, .swiftProtocol: return true case .rawValueEnum(_, let rawType): switch rawType { - case .string, .int, .float, .double: + case .string, .float, .double: return true + case .integer(let integerType): + return !integerType.is64Bit default: return false } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/FixedWidthIntegers.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/FixedWidthIntegers.swift new file mode 100644 index 000000000..8f984acf0 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/FixedWidthIntegers.swift @@ -0,0 +1,19 @@ +import JavaScriptKit + +@JS public func roundTripInt8(_ v: Int8) -> Int8 { v } +@JS public func roundTripUInt8(_ v: UInt8) -> UInt8 { v } +@JS public func roundTripInt16(_ v: Int16) -> Int16 { v } +@JS public func roundTripUInt16(_ v: UInt16) -> UInt16 { v } +@JS public func roundTripInt32(_ v: Int32) -> Int32 { v } +@JS public func roundTripUInt32(_ v: UInt32) -> UInt32 { v } +@JS public func roundTripInt64(_ v: Int64) -> Int64 { v } +@JS public func roundTripUInt64(_ v: UInt64) -> UInt64 { v } + +@JSFunction func roundTripInt8(_ v: Int8) throws(JSException) -> Int8 +@JSFunction func roundTripUInt8(_ v: UInt8) throws(JSException) -> UInt8 +@JSFunction func roundTripInt16(_ v: Int16) throws(JSException) -> Int16 +@JSFunction func roundTripUInt16(_ v: UInt16) throws(JSException) -> UInt16 +@JSFunction func roundTripInt32(_ v: Int32) throws(JSException) -> Int32 +@JSFunction func roundTripUInt32(_ v: UInt32) throws(JSException) -> UInt32 +@JSFunction func roundTripInt64(_ v: Int64) throws(JSException) -> Int64 +@JSFunction func roundTripUInt64(_ v: UInt64) throws(JSException) -> UInt64 diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift index 57d994519..927fac6a0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift @@ -40,6 +40,36 @@ func roundTripInt(value: Int?) -> Int? { return value } +@JS +func roundTripInt8(value: Int8?) -> Int8? { + return value +} + +@JS +func roundTripUInt8(value: UInt8?) -> UInt8? { + return value +} + +@JS +func roundTripInt16(value: Int16?) -> Int16? { + return value +} + +@JS +func roundTripUInt16(value: UInt16?) -> UInt16? { + return value +} + +@JS +func roundTripInt32(value: Int32?) -> Int32? { + return value +} + +@JS +func roundTripUInt32(value: UInt32?) -> UInt32? { + return value +} + @JS func roundTripBool(flag: Bool?) -> Bool? { return flag diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json index 32bdb3374..3664fa339 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json @@ -26,8 +26,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -60,8 +63,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -178,8 +184,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -189,8 +198,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -411,8 +423,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -420,8 +435,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -591,8 +609,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -607,8 +628,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -677,8 +701,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -693,8 +720,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -851,8 +881,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -866,8 +899,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1163,8 +1199,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1185,8 +1224,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1207,8 +1249,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1237,8 +1282,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.json index a780871ba..a2b95cc24 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.json @@ -38,15 +38,21 @@ "label" : "_", "name" : "v", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.json index 10c079b27..4d7495a7c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.json @@ -9,8 +9,11 @@ ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json index 8c088a35e..f8a23c33d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json @@ -92,8 +92,11 @@ "label" : "count", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -167,8 +170,11 @@ "isStatic" : false, "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -296,15 +302,21 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -510,8 +522,11 @@ "label" : "count", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -776,8 +791,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -787,8 +805,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -978,8 +999,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -989,8 +1013,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1046,8 +1073,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1100,8 +1130,11 @@ "isStatic" : false, "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.json index af5b83dc7..c740dc46f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.json @@ -32,8 +32,11 @@ "type" : { "dictionary" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -43,8 +46,11 @@ "returnType" : { "dictionary" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -110,8 +116,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -125,8 +134,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json index 3c624fa12..b92cee954 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json @@ -31,8 +31,11 @@ "associatedValues" : [ { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -118,8 +121,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -137,8 +143,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -196,15 +205,21 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -304,8 +319,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -323,8 +341,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -378,8 +399,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -426,8 +450,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -467,8 +494,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -705,8 +735,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -811,8 +844,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.json index b519748d4..46dbe8917 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.json @@ -30,8 +30,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -56,8 +59,11 @@ "Utils" ], "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -201,8 +207,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -509,15 +518,21 @@ "label" : "rootId", "name" : "rootId", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -544,15 +559,21 @@ "label" : "graphId", "name" : "graphId", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -579,8 +600,11 @@ "label" : "graphId", "name" : "graphId", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.json index a468b2e2c..a57703b09 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.json @@ -30,8 +30,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -56,8 +59,11 @@ "Utils" ], "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -201,8 +207,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -509,15 +518,21 @@ "label" : "rootId", "name" : "rootId", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -544,15 +559,21 @@ "label" : "graphId", "name" : "graphId", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -579,8 +600,11 @@ "label" : "graphId", "name" : "graphId", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift index 4511ed1df..e70a6b0aa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift @@ -228,7 +228,7 @@ public func _bjs_roundTripOptionalPriority(_ inputIsSome: Int32, _ inputValue: I @_expose(wasm, "bjs_setFileSize") @_cdecl("bjs_setFileSize") -public func _bjs_setFileSize(_ size: Int32) -> Void { +public func _bjs_setFileSize(_ size: Int64) -> Void { #if arch(wasm32) setFileSize(_: FileSize.bridgeJSLiftParameter(size)) #else @@ -238,7 +238,7 @@ public func _bjs_setFileSize(_ size: Int32) -> Void { @_expose(wasm, "bjs_getFileSize") @_cdecl("bjs_getFileSize") -public func _bjs_getFileSize() -> Int32 { +public func _bjs_getFileSize() -> Int64 { #if arch(wasm32) let ret = getFileSize() return ret.bridgeJSLowerReturn() @@ -249,7 +249,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: Int64) -> Void { #if arch(wasm32) let ret = roundTripOptionalFileSize(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -324,7 +324,7 @@ public func _bjs_roundTripOptionalTokenId(_ inputIsSome: Int32, _ inputValue: In @_expose(wasm, "bjs_setSessionId") @_cdecl("bjs_setSessionId") -public func _bjs_setSessionId(_ session: Int32) -> Void { +public func _bjs_setSessionId(_ session: Int64) -> Void { #if arch(wasm32) setSessionId(_: SessionId.bridgeJSLiftParameter(session)) #else @@ -334,7 +334,7 @@ public func _bjs_setSessionId(_ session: Int32) -> Void { @_expose(wasm, "bjs_getSessionId") @_cdecl("bjs_getSessionId") -public func _bjs_getSessionId() -> Int32 { +public func _bjs_getSessionId() -> Int64 { #if arch(wasm32) let ret = getSessionId() return ret.bridgeJSLowerReturn() @@ -345,7 +345,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: Int64) -> Void { #if arch(wasm32) let ret = roundTripOptionalSessionId(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -442,7 +442,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: Int64) -> Void { #if arch(wasm32) let ret = validateSession(_: SessionId.bridgeJSLiftParameter(session)) return ret.bridgeJSLowerReturn() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/FixedWidthIntegers.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/FixedWidthIntegers.json new file mode 100644 index 000000000..bef9cbc88 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/FixedWidthIntegers.json @@ -0,0 +1,471 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundTripInt8", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt8", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + }, + { + "abiName" : "bjs_roundTripUInt8", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUInt8", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + }, + { + "abiName" : "bjs_roundTripInt16", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt16", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + }, + { + "abiName" : "bjs_roundTripUInt16", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUInt16", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + }, + { + "abiName" : "bjs_roundTripInt32", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt32", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + }, + { + "abiName" : "bjs_roundTripUInt32", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUInt32", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + }, + { + "abiName" : "bjs_roundTripInt64", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt64", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + }, + { + "abiName" : "bjs_roundTripUInt64", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUInt64", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "roundTripInt8", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + }, + { + "name" : "roundTripUInt8", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + }, + { + "name" : "roundTripInt16", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + }, + { + "name" : "roundTripUInt16", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + }, + { + "name" : "roundTripInt32", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + }, + { + "name" : "roundTripUInt32", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + }, + { + "name" : "roundTripInt64", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + }, + { + "name" : "roundTripUInt64", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/FixedWidthIntegers.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/FixedWidthIntegers.swift new file mode 100644 index 000000000..544a15e7c --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/FixedWidthIntegers.swift @@ -0,0 +1,255 @@ +@_expose(wasm, "bjs_roundTripInt8") +@_cdecl("bjs_roundTripInt8") +public func _bjs_roundTripInt8(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripInt8(_: Int8.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUInt8") +@_cdecl("bjs_roundTripUInt8") +public func _bjs_roundTripUInt8(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripUInt8(_: UInt8.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripInt16") +@_cdecl("bjs_roundTripInt16") +public func _bjs_roundTripInt16(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripInt16(_: Int16.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUInt16") +@_cdecl("bjs_roundTripUInt16") +public func _bjs_roundTripUInt16(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripUInt16(_: UInt16.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripInt32") +@_cdecl("bjs_roundTripInt32") +public func _bjs_roundTripInt32(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripInt32(_: Int32.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUInt32") +@_cdecl("bjs_roundTripUInt32") +public func _bjs_roundTripUInt32(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripUInt32(_: UInt32.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripInt64") +@_cdecl("bjs_roundTripInt64") +public func _bjs_roundTripInt64(_ v: Int64) -> Int64 { + #if arch(wasm32) + let ret = roundTripInt64(_: Int64.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUInt64") +@_cdecl("bjs_roundTripUInt64") +public func _bjs_roundTripUInt64(_ v: Int64) -> Int64 { + #if arch(wasm32) + let ret = roundTripUInt64(_: UInt64.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundTripInt8") +fileprivate func bjs_roundTripInt8_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_roundTripInt8_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_roundTripInt8(_ v: Int32) -> Int32 { + return bjs_roundTripInt8_extern(v) +} + +func _$roundTripInt8(_ v: Int8) throws(JSException) -> Int8 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_roundTripInt8(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int8.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundTripUInt8") +fileprivate func bjs_roundTripUInt8_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_roundTripUInt8_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_roundTripUInt8(_ v: Int32) -> Int32 { + return bjs_roundTripUInt8_extern(v) +} + +func _$roundTripUInt8(_ v: UInt8) throws(JSException) -> UInt8 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_roundTripUInt8(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt8.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundTripInt16") +fileprivate func bjs_roundTripInt16_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_roundTripInt16_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_roundTripInt16(_ v: Int32) -> Int32 { + return bjs_roundTripInt16_extern(v) +} + +func _$roundTripInt16(_ v: Int16) throws(JSException) -> Int16 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_roundTripInt16(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int16.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundTripUInt16") +fileprivate func bjs_roundTripUInt16_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_roundTripUInt16_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_roundTripUInt16(_ v: Int32) -> Int32 { + return bjs_roundTripUInt16_extern(v) +} + +func _$roundTripUInt16(_ v: UInt16) throws(JSException) -> UInt16 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_roundTripUInt16(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt16.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundTripInt32") +fileprivate func bjs_roundTripInt32_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_roundTripInt32_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_roundTripInt32(_ v: Int32) -> Int32 { + return bjs_roundTripInt32_extern(v) +} + +func _$roundTripInt32(_ v: Int32) throws(JSException) -> Int32 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_roundTripInt32(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int32.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundTripUInt32") +fileprivate func bjs_roundTripUInt32_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_roundTripUInt32_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_roundTripUInt32(_ v: Int32) -> Int32 { + return bjs_roundTripUInt32_extern(v) +} + +func _$roundTripUInt32(_ v: UInt32) throws(JSException) -> UInt32 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_roundTripUInt32(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt32.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundTripInt64") +fileprivate func bjs_roundTripInt64_extern(_ v: Int64) -> Int64 +#else +fileprivate func bjs_roundTripInt64_extern(_ v: Int64) -> Int64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_roundTripInt64(_ v: Int64) -> Int64 { + return bjs_roundTripInt64_extern(v) +} + +func _$roundTripInt64(_ v: Int64) throws(JSException) -> Int64 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_roundTripInt64(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int64.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundTripUInt64") +fileprivate func bjs_roundTripUInt64_extern(_ v: Int64) -> Int64 +#else +fileprivate func bjs_roundTripUInt64_extern(_ v: Int64) -> Int64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_roundTripUInt64(_ v: Int64) -> Int64 { + return bjs_roundTripUInt64_extern(v) +} + +func _$roundTripUInt64(_ v: UInt64) throws(JSException) -> UInt64 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_roundTripUInt64(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt64.bridgeJSLiftReturn(ret) +} \ 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 index b884e0cb9..7f79a8146 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.json @@ -11,8 +11,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -22,8 +25,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.json index 29cbddeb7..9ca72009d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.json @@ -76,8 +76,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.json index 619fe0689..0713a2f30 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.json @@ -76,8 +76,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json index 9c99bb8c4..67d97821c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json @@ -134,8 +134,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -286,8 +289,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -298,8 +304,257 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripInt8", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt8", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripUInt8", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUInt8", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripInt16", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt16", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripUInt16", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUInt16", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripInt32", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt32", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripUInt32", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUInt32", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } } }, "_1" : "null" @@ -601,8 +856,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -613,8 +871,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -699,8 +960,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -858,8 +1122,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -871,8 +1138,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "undefined" @@ -1057,8 +1327,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1069,8 +1342,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1085,8 +1361,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "undefined" @@ -1097,8 +1376,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "undefined" @@ -1198,8 +1480,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1212,8 +1497,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "undefined" diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift index 8207bd488..0c6a79bf5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift @@ -42,6 +42,72 @@ public func _bjs_roundTripInt(_ valueIsSome: Int32, _ valueValue: Int32) -> Void #endif } +@_expose(wasm, "bjs_roundTripInt8") +@_cdecl("bjs_roundTripInt8") +public func _bjs_roundTripInt8(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripInt8(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUInt8") +@_cdecl("bjs_roundTripUInt8") +public func _bjs_roundTripUInt8(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripUInt8(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripInt16") +@_cdecl("bjs_roundTripInt16") +public func _bjs_roundTripInt16(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripInt16(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUInt16") +@_cdecl("bjs_roundTripUInt16") +public func _bjs_roundTripUInt16(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripUInt16(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripInt32") +@_cdecl("bjs_roundTripInt32") +public func _bjs_roundTripInt32(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripInt32(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUInt32") +@_cdecl("bjs_roundTripUInt32") +public func _bjs_roundTripUInt32(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripUInt32(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripBool") @_cdecl("bjs_roundTripBool") public func _bjs_roundTripBool(_ flagIsSome: Int32, _ flagValue: Int32) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.json index 8b586dbe0..f75bf7610 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.json @@ -21,8 +21,11 @@ "label" : "a", "name" : "a", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -30,8 +33,11 @@ "label" : "b", "name" : "b", "type" : { - "uint" : { - + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.json index aae09ea49..cded9a973 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.json @@ -20,8 +20,11 @@ ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -37,8 +40,11 @@ ], "returnType" : { - "uint" : { - + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.json index 1c71b2b8f..24e3f44cd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.json @@ -14,8 +14,11 @@ "label" : "intValue", "name" : "intValue", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -92,8 +95,11 @@ "isStatic" : false, "name" : "intValue", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -142,8 +148,11 @@ "isStatic" : false, "name" : "readonlyInt", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -222,8 +231,11 @@ "isStatic" : false, "name" : "computedReadonly", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -242,8 +254,11 @@ "isStatic" : false, "name" : "observedProperty", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -269,8 +284,11 @@ "label" : "intValue", "name" : "intValue", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json index e9f5264cd..757115c59 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json @@ -14,8 +14,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -47,8 +50,11 @@ "isStatic" : false, "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -131,8 +137,11 @@ "label" : "_", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -399,8 +408,11 @@ "associatedValues" : [ { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -550,8 +562,11 @@ "label" : "count", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -774,8 +789,11 @@ "isReadonly" : false, "name" : "eventCount", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.json index b0eac3313..c241595a3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.json @@ -27,8 +27,11 @@ "label" : "a", "name" : "a", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -36,15 +39,21 @@ "label" : "b", "name" : "b", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -66,8 +75,11 @@ "label" : "a", "name" : "a", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -75,15 +87,21 @@ "label" : "b", "name" : "b", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -105,8 +123,11 @@ "label" : "x", "name" : "x", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -114,15 +135,21 @@ "label" : "y", "name" : "y", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -166,15 +193,21 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -208,8 +241,11 @@ "associatedValues" : [ { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.json index e4ec22855..7c5df25b7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.json @@ -27,8 +27,11 @@ "label" : "a", "name" : "a", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -36,15 +39,21 @@ "label" : "b", "name" : "b", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -66,8 +75,11 @@ "label" : "a", "name" : "a", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -75,15 +87,21 @@ "label" : "b", "name" : "b", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -105,8 +123,11 @@ "label" : "x", "name" : "x", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -114,15 +135,21 @@ "label" : "y", "name" : "y", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -166,15 +193,21 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -208,8 +241,11 @@ "associatedValues" : [ { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json index bb9e48091..d14f9b0a3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json @@ -43,8 +43,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -103,8 +106,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -179,8 +185,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -280,8 +289,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json index d385e3887..35d740dff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json @@ -43,8 +43,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -103,8 +106,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -179,8 +185,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -280,8 +289,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json index 11c6cb893..f610d4bde 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json @@ -215,8 +215,11 @@ "associatedValues" : [ { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -362,14 +365,20 @@ "moduleName" : "TestModule", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -387,14 +396,20 @@ "moduleName" : "TestModule", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -689,8 +704,11 @@ { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -700,8 +718,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -724,8 +745,11 @@ { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -735,8 +759,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json index 0013c810c..4359b50ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json @@ -9,8 +9,11 @@ { "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -25,14 +28,20 @@ "moduleName" : "TestModule", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -42,8 +51,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -53,8 +65,11 @@ { "name" : "base", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -68,14 +83,20 @@ "moduleName" : "TestModule", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json index 00c6af5cb..eeb567d4a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json @@ -186,8 +186,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -252,8 +255,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -311,8 +317,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -343,8 +352,11 @@ "isStatic" : false, "name" : "age", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -387,8 +399,11 @@ "isStatic" : false, "name" : "id", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -496,8 +511,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.json index 50af441a9..c1329cd79 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.json @@ -25,8 +25,11 @@ "isStatic" : false, "name" : "x", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -35,8 +38,11 @@ "isStatic" : false, "name" : "y", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -63,16 +69,22 @@ { "name" : "dx", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, { "name" : "dy", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index fcd29e31a..85e9c749a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -34,6 +34,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -116,6 +117,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_struct_lower_Point"] = function(objectId) { structHelpers.Point.lower(swift.memory.getObject(objectId)); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index d274e5606..bf368738e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 67e73fb33..004320e4b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -27,6 +27,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -133,6 +134,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_struct_lower_Config"] = function(objectId) { structHelpers.Config.lower(swift.memory.getObject(objectId)); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 7c31ce220..1e9059e34 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 18cc2c945..eb474d3b0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -102,6 +102,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -824,6 +825,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_struct_lower_Point"] = function(objectId) { structHelpers.Point.lower(swift.memory.getObject(objectId)); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index a79d508a0..fe94c046f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -45,6 +45,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -115,6 +116,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index e52cf02d5..948039cf9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -65,6 +65,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -135,6 +136,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 2d05a7a2d..5201350b2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -46,6 +46,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -116,6 +117,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts index 50a45a58d..fbd5ad637 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts @@ -46,10 +46,10 @@ export const PriorityValues: { export type PriorityTag = typeof PriorityValues[keyof typeof PriorityValues]; export const FileSizeValues: { - readonly Tiny: 1024; - readonly Small: 10240; - readonly Medium: 102400; - readonly Large: 1048576; + readonly Tiny: 1024n; + readonly Small: 10240n; + readonly Medium: 102400n; + readonly Large: 1048576n; }; export type FileSizeTag = typeof FileSizeValues[keyof typeof FileSizeValues]; @@ -68,9 +68,9 @@ export const TokenIdValues: { export type TokenIdTag = typeof TokenIdValues[keyof typeof TokenIdValues]; export const SessionIdValues: { - readonly None: 0; - readonly Active: 9876543210; - readonly Expired: 1234567890; + readonly None: 0n; + readonly Active: 9876543210n; + readonly Expired: 1234567890n; }; export type SessionIdTag = typeof SessionIdValues[keyof typeof SessionIdValues]; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 5d28ce60b..7e5334811 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -42,10 +42,10 @@ export const PriorityValues = { }; export const FileSizeValues = { - Tiny: 1024, - Small: 10240, - Medium: 102400, - Large: 1048576, + Tiny: 1024n, + Small: 10240n, + Medium: 102400n, + Large: 1048576n, }; export const UserIdValues = { @@ -61,9 +61,9 @@ export const TokenIdValues = { }; export const SessionIdValues = { - None: 0, - Active: 9876543210, - Expired: 1234567890, + None: 0n, + Active: 9876543210n, + Expired: 1234567890n, }; export const PrecisionValues = { @@ -96,6 +96,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -167,6 +168,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -426,8 +433,14 @@ export async function createInstantiator(options, swift) { roundTripOptionalFileSize: function bjs_roundTripOptionalFileSize(input) { const isSome = input != null; instance.exports.bjs_roundTripOptionalFileSize(+isSome, isSome ? input : 0); - const optResult = tmpRetOptionalInt; - tmpRetOptionalInt = undefined; + const isSome1 = i32Stack.pop(); + let optResult; + if (isSome1) { + const rawValue = i64Stack.pop(); + optResult = rawValue; + } else { + optResult = null; + } return optResult; }, setUserId: function bjs_setUserId(id) { @@ -435,7 +448,7 @@ export async function createInstantiator(options, swift) { }, getUserId: function bjs_getUserId() { const ret = instance.exports.bjs_getUserId(); - return ret; + return ret >>> 0; }, roundTripOptionalUserId: function bjs_roundTripOptionalUserId(input) { const isSome = input != null; @@ -449,7 +462,7 @@ export async function createInstantiator(options, swift) { }, getTokenId: function bjs_getTokenId() { const ret = instance.exports.bjs_getTokenId(); - return ret; + return ret >>> 0; }, roundTripOptionalTokenId: function bjs_roundTripOptionalTokenId(input) { const isSome = input != null; @@ -463,13 +476,19 @@ export async function createInstantiator(options, swift) { }, getSessionId: function bjs_getSessionId() { const ret = instance.exports.bjs_getSessionId(); - return ret; + return BigInt.asUintN(64, ret); }, roundTripOptionalSessionId: function bjs_roundTripOptionalSessionId(input) { const isSome = input != null; instance.exports.bjs_roundTripOptionalSessionId(+isSome, isSome ? input : 0); - const optResult = tmpRetOptionalInt; - tmpRetOptionalInt = undefined; + const isSome1 = i32Stack.pop(); + let optResult; + if (isSome1) { + const rawValue = i64Stack.pop(); + optResult = rawValue; + } else { + optResult = null; + } return optResult; }, setPrecision: function bjs_setPrecision(precision) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts new file mode 100644 index 000000000..d6ab5aa8f --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.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`. + +export type Exports = { + roundTripInt8(v: number): number; + roundTripUInt8(v: number): number; + roundTripInt16(v: number): number; + roundTripUInt16(v: number): number; + roundTripInt32(v: number): number; + roundTripUInt32(v: number): number; + roundTripInt64(v: bigint): bigint; + roundTripUInt64(v: bigint): bigint; +} +export type Imports = { + roundTripInt8(v: number): number; + roundTripUInt8(v: number): number; + roundTripInt16(v: number): number; + roundTripUInt16(v: number): number; + roundTripInt32(v: number): number; + roundTripUInt32(v: number): number; + roundTripInt64(v: bigint): bigint; + roundTripUInt64(v: bigint): bigint; +} +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/FixedWidthIntegers.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js new file mode 100644 index 000000000..53ddd7301 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js @@ -0,0 +1,317 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + let decodeString; + const textDecoder = new TextDecoder("utf-8"); + const textEncoder = new TextEncoder("utf-8"); + let tmpRetString; + let tmpRetBytes; + let tmpRetException; + let tmpRetOptionalBool; + let tmpRetOptionalInt; + let tmpRetOptionalFloat; + let tmpRetOptionalDouble; + let tmpRetOptionalHeapObject; + let strStack = []; + let i32Stack = []; + let i64Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + tmpRetString = decodeString(ptr, len); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + swift.memory.release(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + return swift.memory.retain(decodeString(ptr, len)); + } + bjs["swift_js_init_memory_with_result"] = function(ptr, len) { + const target = new Uint8Array(memory.buffer, ptr, len); + target.set(tmpRetBytes); + tmpRetBytes = undefined; + } + bjs["swift_js_throw"] = function(id) { + tmpRetException = swift.memory.retainByRef(id); + } + bjs["swift_js_retain"] = function(id) { + return swift.memory.retainByRef(id); + } + bjs["swift_js_release"] = function(id) { + swift.memory.release(id); + } + bjs["swift_js_push_i32"] = function(v) { + i32Stack.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + f32Stack.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + f64Stack.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const value = decodeString(ptr, len); + strStack.push(value); + } + bjs["swift_js_pop_i32"] = function() { + return i32Stack.pop(); + } + bjs["swift_js_pop_f32"] = function() { + return f32Stack.pop(); + } + bjs["swift_js_pop_f64"] = function() { + return f64Stack.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + ptrStack.push(pointer); + } + bjs["swift_js_pop_pointer"] = function() { + return ptrStack.pop(); + } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } + bjs["swift_js_return_optional_bool"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalBool = null; + } else { + tmpRetOptionalBool = value !== 0; + } + } + bjs["swift_js_return_optional_int"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalInt = null; + } else { + tmpRetOptionalInt = value | 0; + } + } + bjs["swift_js_return_optional_float"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalFloat = null; + } else { + tmpRetOptionalFloat = Math.fround(value); + } + } + bjs["swift_js_return_optional_double"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalDouble = null; + } else { + tmpRetOptionalDouble = value; + } + } + bjs["swift_js_return_optional_string"] = function(isSome, ptr, len) { + if (isSome === 0) { + tmpRetString = null; + } else { + tmpRetString = decodeString(ptr, len); + } + } + bjs["swift_js_return_optional_object"] = function(isSome, objectId) { + if (isSome === 0) { + tmpRetString = null; + } else { + tmpRetString = swift.memory.getObject(objectId); + } + } + bjs["swift_js_return_optional_heap_object"] = function(isSome, pointer) { + if (isSome === 0) { + tmpRetOptionalHeapObject = null; + } else { + tmpRetOptionalHeapObject = pointer; + } + } + bjs["swift_js_get_optional_int_presence"] = function() { + return tmpRetOptionalInt != null ? 1 : 0; + } + bjs["swift_js_get_optional_int_value"] = function() { + const value = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return value; + } + bjs["swift_js_get_optional_string"] = function() { + const str = tmpRetString; + tmpRetString = undefined; + if (str == null) { + return -1; + } else { + const bytes = textEncoder.encode(str); + tmpRetBytes = bytes; + return bytes.length; + } + } + bjs["swift_js_get_optional_float_presence"] = function() { + return tmpRetOptionalFloat != null ? 1 : 0; + } + bjs["swift_js_get_optional_float_value"] = function() { + const value = tmpRetOptionalFloat; + tmpRetOptionalFloat = undefined; + return value; + } + bjs["swift_js_get_optional_double_presence"] = function() { + return tmpRetOptionalDouble != null ? 1 : 0; + } + bjs["swift_js_get_optional_double_value"] = function() { + const value = tmpRetOptionalDouble; + tmpRetOptionalDouble = undefined; + return value; + } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } + bjs["swift_js_closure_unregister"] = function(funcRef) {} + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_roundTripInt8"] = function bjs_roundTripInt8(v) { + try { + let ret = imports.roundTripInt8(v); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_roundTripUInt8"] = function bjs_roundTripUInt8(v) { + try { + let ret = imports.roundTripUInt8(v >>> 0); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_roundTripInt16"] = function bjs_roundTripInt16(v) { + try { + let ret = imports.roundTripInt16(v); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_roundTripUInt16"] = function bjs_roundTripUInt16(v) { + try { + let ret = imports.roundTripUInt16(v >>> 0); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_roundTripInt32"] = function bjs_roundTripInt32(v) { + try { + let ret = imports.roundTripInt32(v); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_roundTripUInt32"] = function bjs_roundTripUInt32(v) { + try { + let ret = imports.roundTripUInt32(v >>> 0); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_roundTripInt64"] = function bjs_roundTripInt64(v) { + try { + let ret = imports.roundTripInt64(v); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_roundTripUInt64"] = function bjs_roundTripUInt64(v) { + try { + let ret = imports.roundTripUInt64(BigInt.asUintN(64, v)); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + decodeString = (ptr, len) => { const bytes = new Uint8Array(memory.buffer, ptr >>> 0, len >>> 0); return textDecoder.decode(bytes); } + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + roundTripInt8: function bjs_roundTripInt8(v) { + const ret = instance.exports.bjs_roundTripInt8(v); + return ret; + }, + roundTripUInt8: function bjs_roundTripUInt8(v) { + const ret = instance.exports.bjs_roundTripUInt8(v); + return ret >>> 0; + }, + roundTripInt16: function bjs_roundTripInt16(v) { + const ret = instance.exports.bjs_roundTripInt16(v); + return ret; + }, + roundTripUInt16: function bjs_roundTripUInt16(v) { + const ret = instance.exports.bjs_roundTripUInt16(v); + return ret >>> 0; + }, + roundTripInt32: function bjs_roundTripInt32(v) { + const ret = instance.exports.bjs_roundTripInt32(v); + return ret; + }, + roundTripUInt32: function bjs_roundTripUInt32(v) { + const ret = instance.exports.bjs_roundTripUInt32(v); + return ret >>> 0; + }, + roundTripInt64: function bjs_roundTripInt64(v) { + const ret = instance.exports.bjs_roundTripInt64(v); + return ret; + }, + roundTripUInt64: function bjs_roundTripUInt64(v) { + const ret = instance.exports.bjs_roundTripUInt64(v); + return BigInt.asUintN(64, ret); + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index 4d1e7abdf..346b74eac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index e4a17ebd0..f74095374 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index 7a97a47ff..06cf6550e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index cfb0f75e7..c469fcb58 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -130,6 +131,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_struct_lower_FooContainer"] = function(objectId) { structHelpers.FooContainer.lower(swift.memory.getObject(objectId)); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index ca54d8f16..952197c2a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 7e97170e9..88a5adb38 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 39a859e4a..10fafb7a0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 9ed0b93f2..08675da6a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -181,6 +182,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 1b5651765..f4fe4dd61 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 840a7a107..4ce318f40 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 672d5ef7b..025a6fc8a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 8401e96b4..4a6ee1990 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index 9efb38ffa..267d96152 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts index b1a67ccde..a5a6e16fb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts @@ -50,6 +50,12 @@ export type Exports = { testOptionalPropertyRoundtrip(holder: OptionalPropertyHolder | null): OptionalPropertyHolder | null; roundTripString(name: string | null): string | null; roundTripInt(value: number | null): number | null; + roundTripInt8(value: number | null): number | null; + roundTripUInt8(value: number | null): number | null; + roundTripInt16(value: number | null): number | null; + roundTripUInt16(value: number | null): number | null; + roundTripInt32(value: number | null): number | null; + roundTripUInt32(value: number | null): number | null; roundTripBool(flag: boolean | null): boolean | null; roundTripFloat(number: number | null): number | null; roundTripDouble(precision: number | null): number | null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index f247c8efc..37408a42d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -661,6 +668,48 @@ export async function createInstantiator(options, swift) { tmpRetOptionalInt = undefined; return optResult; }, + roundTripInt8: function bjs_roundTripInt8(value) { + const isSome = value != null; + instance.exports.bjs_roundTripInt8(+isSome, isSome ? value : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; + }, + roundTripUInt8: function bjs_roundTripUInt8(value) { + const isSome = value != null; + instance.exports.bjs_roundTripUInt8(+isSome, isSome ? value : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; + }, + roundTripInt16: function bjs_roundTripInt16(value) { + const isSome = value != null; + instance.exports.bjs_roundTripInt16(+isSome, isSome ? value : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; + }, + roundTripUInt16: function bjs_roundTripUInt16(value) { + const isSome = value != null; + instance.exports.bjs_roundTripUInt16(+isSome, isSome ? value : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; + }, + roundTripInt32: function bjs_roundTripInt32(value) { + const isSome = value != null; + instance.exports.bjs_roundTripInt32(+isSome, isSome ? value : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; + }, + roundTripUInt32: function bjs_roundTripUInt32(value) { + const isSome = value != null; + instance.exports.bjs_roundTripUInt32(+isSome, isSome ? value : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; + }, roundTripBool: function bjs_roundTripBool(flag) { const isSome = flag != null; instance.exports.bjs_roundTripBool(+isSome, isSome ? flag ? 1 : 0 : 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 770212417..490f2b4e2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index 0efb2d2b5..bec07b959 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 338e87f9a..658702a39 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 79711d878..e606c3a77 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -45,6 +45,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -148,6 +149,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js index ffdac6fa6..13070a3cc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -116,6 +117,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 800b07107..073784583 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -32,6 +32,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -135,6 +136,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index a4290f828..173bd6c27 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -32,6 +32,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -135,6 +136,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 056293ff7..9928804eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -26,6 +26,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -96,6 +97,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index 06f032555..f82ac20df 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -26,6 +26,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -96,6 +97,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index d602d4e5a..033f08cd2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index b2241d6ca..8187b9e92 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 9acf70de2..4dd231e0e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index a0e874907..7e90c9415 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -51,6 +51,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -207,6 +208,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 42ca68e78..d9df868ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -117,6 +118,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index cd2d396df..4334bec62 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -26,6 +26,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -281,6 +282,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_struct_lower_DataPoint"] = function(objectId) { structHelpers.DataPoint.lower(swift.memory.getObject(objectId)); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index cb161707a..d4f1160f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -103,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_struct_lower_Point"] = function(objectId) { structHelpers.Point.lower(swift.memory.getObject(objectId)); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index ae9625f00..b2c381a03 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -91,6 +92,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index 169b001cf..ef81ef69e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -108,6 +109,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_struct_lower_PointerFields"] = function(objectId) { structHelpers.PointerFields.lower(swift.memory.getObject(objectId)); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index cc6c0359b..97948b286 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -21,6 +21,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalHeapObject; let strStack = []; let i32Stack = []; + let i64Stack = []; let f32Stack = []; let f64Stack = []; let ptrStack = []; @@ -92,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index fd183583b..3dda6b28e 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -65,6 +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_push_i64: unexpectedBjsCall, + swift_js_pop_i64: unexpectedBjsCall, swift_js_closure_unregister: unexpectedBjsCall, }; }, diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index c2d1c4cd8..180567ed1 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -261,39 +261,139 @@ extension UInt: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftSta } } -extension Int32: _BridgedSwiftStackType { +extension Int8: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { Int32(self) } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Int8 { + Int8(truncatingIfNeeded: value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Int8 { + Int8(truncatingIfNeeded: value) + } + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Int8 { bridgeJSLiftParameter(_swift_js_pop_i32()) } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(self) } + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(self)) } +} + +extension UInt8: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { Int32(self) } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> UInt8 { + UInt8(truncatingIfNeeded: value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> UInt8 { + UInt8(truncatingIfNeeded: value) + } + @_spi(BridgeJS) public static func bridgeJSStackPop() -> UInt8 { bridgeJSLiftParameter(_swift_js_pop_i32()) } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(self) } + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(self)) } +} + +extension Int16: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { Int32(self) } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Int16 { + Int16(truncatingIfNeeded: value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Int16 { + Int16(truncatingIfNeeded: value) + } + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Int16 { bridgeJSLiftParameter(_swift_js_pop_i32()) } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(self) } + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(self)) } +} + +extension UInt16: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { Int32(self) } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> UInt16 { + UInt16(truncatingIfNeeded: value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> UInt16 { + UInt16(truncatingIfNeeded: value) + } + @_spi(BridgeJS) public static func bridgeJSStackPop() -> UInt16 { bridgeJSLiftParameter(_swift_js_pop_i32()) } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(self) } + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(self)) } +} + +extension Int32: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { self } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Int32 { value } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Int32 { value } @_spi(BridgeJS) public static func bridgeJSStackPop() -> Int32 { _swift_js_pop_i32() } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { self } @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(self) } } -extension Int64: _BridgedSwiftStackType { - @_spi(BridgeJS) public static func bridgeJSStackPop() -> Int64 { - Int64(_swift_js_pop_i32()) +extension UInt32: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { Int32(bitPattern: self) } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> UInt32 { + UInt32(bitPattern: value) } - @_spi(BridgeJS) public consuming func bridgeJSStackPush() { - _swift_js_push_i32(Int32(self)) + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> UInt32 { + UInt32(bitPattern: value) } -} - -extension UInt32: _BridgedSwiftStackType { @_spi(BridgeJS) public static func bridgeJSStackPop() -> UInt32 { UInt32(bitPattern: _swift_js_pop_i32()) } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(bitPattern: self) } @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(bitPattern: self)) } } -extension UInt64: _BridgedSwiftStackType { +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_push_i64") +private func _swift_js_push_i64_extern(_ v: Int64) +#else +private func _swift_js_push_i64_extern(_ v: Int64) { + _onlyAvailableOnWasm() +} +#endif +@_spi(BridgeJS) @inline(never) public func _swift_js_push_i64(_ v: Int64) { + _swift_js_push_i64_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_pop_i64") +private func _swift_js_pop_i64_extern() -> Int64 +#else +private func _swift_js_pop_i64_extern() -> Int64 { + _onlyAvailableOnWasm() +} +#endif +@_spi(BridgeJS) @inline(never) public func _swift_js_pop_i64() -> Int64 { + return _swift_js_pop_i64_extern() +} + +extension Int64: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int64 { self } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int64) -> Int64 { value } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int64) -> Int64 { value } + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Int64 { + Int64(bitPattern: UInt64(bitPattern: _swift_js_pop_i64())) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int64 { self } + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { + _swift_js_push_i64(self) + } +} + +extension UInt64: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int64 { Int64(bitPattern: self) } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int64) -> UInt64 { + UInt64(bitPattern: value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int64) -> UInt64 { + UInt64(bitPattern: value) + } @_spi(BridgeJS) public static func bridgeJSStackPop() -> UInt64 { - UInt64(UInt32(bitPattern: _swift_js_pop_i32())) + UInt64(bitPattern: _swift_js_pop_i64()) } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int64 { Int64(bitPattern: self) } @_spi(BridgeJS) public consuming func bridgeJSStackPush() { - _swift_js_push_i32(Int32(bitPattern: UInt32(self))) + _swift_js_push_i64(Int64(bitPattern: self)) } } @@ -1319,15 +1419,10 @@ public protocol _BridgedSwiftOptionalScalarSideChannelBridge: _BridgedSwiftOptio @_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) - } -} +private protocol _BridgedSwiftOptionalInt32SideChannelBridge: _BridgedSwiftOptionalScalarSideChannelBridge +where WasmCoreType == Int32 {} -extension Int: _BridgedSwiftOptionalScalarSideChannelBridge { +extension _BridgedSwiftOptionalInt32SideChannelBridge { @_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) { @@ -1341,20 +1436,23 @@ extension Int: _BridgedSwiftOptionalScalarSideChannelBridge { } } -extension UInt: _BridgedSwiftOptionalScalarSideChannelBridge { +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_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() + _swift_js_return_optional_bool(isSome, value) } } +extension Int: _BridgedSwiftOptionalInt32SideChannelBridge {} +extension UInt: _BridgedSwiftOptionalInt32SideChannelBridge {} +extension Int8: _BridgedSwiftOptionalInt32SideChannelBridge {} +extension UInt8: _BridgedSwiftOptionalInt32SideChannelBridge {} +extension Int16: _BridgedSwiftOptionalInt32SideChannelBridge {} +extension UInt16: _BridgedSwiftOptionalInt32SideChannelBridge {} +extension Int32: _BridgedSwiftOptionalInt32SideChannelBridge {} +extension UInt32: _BridgedSwiftOptionalInt32SideChannelBridge {} + extension Float: _BridgedSwiftOptionalScalarSideChannelBridge { @_spi(BridgeJS) public static func bridgeJSPopOptionalScalarPayload() -> Float32 { _swift_js_pop_f32() } @_spi(BridgeJS) public static var bridgeJSOptionalScalarNonePayload: Float32 { 0.0 } @@ -1750,115 +1848,69 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra } extension _BridgedAsOptional -where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - switch asOptional { - case .none: - return (isSome: 0, value: 0) - case .some(let value): - return (isSome: 1, value: value.bridgeJSLowerParameter()) - } - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - let optionalRawValue = Optional.bridgeJSLiftParameter(isSome, wrappedValue) - return Self(optional: optionalRawValue.flatMap { Wrapped(rawValue: $0) }) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - let isSome = _swift_js_get_optional_int_presence() - if isSome == 0 { - return Self(optional: nil) - } else { - let rawValue = _swift_js_get_optional_int_value() - return Self(optional: Wrapped(rawValue: Int(rawValue))) - } - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - let optionalRawValue: Int? = asOptional?.rawValue - optionalRawValue.bridgeJSLowerReturn() +where + Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, + Wrapped.RawValue: _BridgedSwiftOptionalScalarBridge +{ + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> ( + isSome: Int32, value: Wrapped.RawValue.WasmCoreType + ) { + let optionalRawValue: Wrapped.RawValue? = asOptional?.rawValue + return optionalRawValue.bridgeJSLowerParameter() } -} -extension _BridgedAsOptional -where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Bool { - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - let optionalRawValue = Optional.bridgeJSLiftParameter(isSome, wrappedValue) + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ wrappedValue: Wrapped.RawValue.WasmCoreType + ) -> Self { + let optionalRawValue = Optional.bridgeJSLiftParameter(isSome, wrappedValue) return Self(optional: optionalRawValue.flatMap { Wrapped(rawValue: $0) }) } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - let optionalRawValue: Bool? = asOptional?.rawValue + let optionalRawValue: Wrapped.RawValue? = asOptional?.rawValue optionalRawValue.bridgeJSLowerReturn() } } extension _BridgedAsOptional -where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Float { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( - isSome: Int32, value: Float32 +where + Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: _BridgedSwiftRawValueEnum, Wrapped: RawRepresentable, + Wrapped.RawValue: _BridgedSwiftStackType, + Wrapped.RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, + Wrapped.RawValue.WasmCoreType == Int64 +{ + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> ( + isSome: Int32, value: Int64 ) { switch asOptional { case .none: - return (isSome: 0, value: 0.0) + return (isSome: 0, value: 0) case .some(let wrapped): return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { - let optionalRawValue = Optional.bridgeJSLiftParameter(isSome, wrappedValue) - return Self(optional: optionalRawValue.flatMap { Wrapped(rawValue: $0) }) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - let isSome = _swift_js_get_optional_float_presence() + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int64) -> Self { if isSome == 0 { return Self(optional: nil) - } else { - let rawValue = _swift_js_get_optional_float_value() - return Self(optional: Wrapped(rawValue: Float(rawValue))) } + return Self(optional: Wrapped(rawValue: Wrapped.RawValue.bridgeJSLiftParameter(wrappedValue))) } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - let optionalRawValue: Float? = asOptional?.rawValue - optionalRawValue.bridgeJSLowerReturn() + Wrapped.bridgeJSStackPushAsOptional(asOptional) } } extension _BridgedAsOptional -where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Double { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( - isSome: Int32, value: Float64 - ) { - switch asOptional { - 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) -> Self { - let optionalRawValue = Optional.bridgeJSLiftParameter(isSome, wrappedValue) - return Self(optional: optionalRawValue.flatMap { Wrapped(rawValue: $0) }) - } - +where + Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, + Wrapped.RawValue: _BridgedSwiftOptionalScalarSideChannelBridge +{ @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - let isSome = _swift_js_get_optional_double_presence() - if isSome == 0 { - return Self(optional: nil) - } else { - let rawValue = _swift_js_get_optional_double_value() - return Self(optional: Wrapped(rawValue: Double(rawValue))) - } - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - let optionalRawValue: Double? = asOptional?.rawValue - optionalRawValue.bridgeJSLowerReturn() + let optionalRawValue = Optional.bridgeJSLiftReturnFromSideChannel() + return Self(optional: optionalRawValue.flatMap { Wrapped(rawValue: $0) }) } } diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json index 9403e3b0c..f57f91936 100644 --- a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json @@ -138,8 +138,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -164,8 +167,11 @@ "GlobalUtils" ], "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -476,8 +482,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, diff --git a/Tests/BridgeJSRuntimeTests/ArraySupportTests.swift b/Tests/BridgeJSRuntimeTests/ArraySupportTests.swift index 6795c79ec..90c4b138e 100644 --- a/Tests/BridgeJSRuntimeTests/ArraySupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/ArraySupportTests.swift @@ -190,6 +190,8 @@ final class ArraySupportTests: XCTestCase { @JS static func roundTripCaseEnumArray(_ v: [Direction]) -> [Direction] { v } @JS static func roundTripStringRawValueEnumArray(_ v: [Theme]) -> [Theme] { v } @JS static func roundTripIntRawValueEnumArray(_ v: [HttpStatus]) -> [HttpStatus] { v } + @JS static func roundTripInt64RawValueEnumArray(_ v: [FileSize]) -> [FileSize] { v } + @JS static func roundTripUInt64RawValueEnumArray(_ v: [SessionId]) -> [SessionId] { v } @JS static func roundTripStructArray(_ v: [DataPoint]) -> [DataPoint] { v } @JS static func roundTripSwiftClassArray(_ v: [Greeter]) -> [Greeter] { v } @JS static func roundTripNamespacedSwiftClassArray(_ v: [Utils.Converter]) -> [Utils.Converter] { v } @@ -202,6 +204,8 @@ final class ArraySupportTests: XCTestCase { @JS static func roundTripOptionalCaseEnumArray(_ v: [Direction?]) -> [Direction?] { v } @JS static func roundTripOptionalStringRawValueEnumArray(_ v: [Theme?]) -> [Theme?] { v } @JS static func roundTripOptionalIntRawValueEnumArray(_ v: [HttpStatus?]) -> [HttpStatus?] { v } + @JS static func roundTripOptionalInt64RawValueEnumArray(_ v: [FileSize?]) -> [FileSize?] { v } + @JS static func roundTripOptionalUInt64RawValueEnumArray(_ v: [SessionId?]) -> [SessionId?] { v } @JS static func roundTripOptionalStructArray(_ v: [DataPoint?]) -> [DataPoint?] { v } @JS static func roundTripOptionalSwiftClassArray(_ v: [Greeter?]) -> [Greeter?] { v } @JS static func roundTripOptionalJSClassArray(_ v: [ArrayElementObject?]) -> [ArrayElementObject?] { v } diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index d2fe49db2..595f6c051 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -10,12 +10,6 @@ func runJsWorks() -> Void return } -@JS func roundTripInt(v: Int) -> Int { - return v -} -@JS func roundTripUInt(v: UInt) -> UInt { - return v -} @JS func roundTripFloat(v: Float) -> Float { return v } @@ -225,6 +219,19 @@ struct TestError: Error { case unknown = -1 } +@JS enum FileSize: Int64 { + case tiny = 1024 + case small = 10240 + case medium = 102400 + case large = 1048576 +} + +@JS enum SessionId: UInt64 { + case none = 0 + case active = 9876543210 + case expired = 1234567890 +} + @JS enum Precision: Float { case rough = 0.1 case normal = 0.01 @@ -281,6 +288,22 @@ struct TestError: Error { return .ok } +@JS func setFileSize(_ size: FileSize) -> FileSize { + return size +} + +@JS func getFileSize() -> FileSize { + return .small +} + +@JS func setSessionId(_ session: SessionId) -> SessionId { + return session +} + +@JS func getSessionId() -> SessionId { + return .active +} + @JS func processTheme(_ theme: Theme) -> HttpStatus { switch theme { case .light: return .ok diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index e9c0e7653..e01761a8e 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2685,6 +2685,28 @@ public func _bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray() -> V #endif } +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripInt64RawValueEnumArray(_: [FileSize].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripUInt64RawValueEnumArray(_: [SessionId].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_ArraySupportExports_static_roundTripStructArray") @_cdecl("bjs_ArraySupportExports_static_roundTripStructArray") public func _bjs_ArraySupportExports_static_roundTripStructArray() -> Void { @@ -2808,6 +2830,28 @@ public func _bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArra #endif } +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalInt64RawValueEnumArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalUInt64RawValueEnumArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalStructArray") @_cdecl("bjs_ArraySupportExports_static_roundTripOptionalStructArray") public func _bjs_ArraySupportExports_static_roundTripOptionalStructArray() -> Void { @@ -3223,6 +3267,12 @@ extension Theme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { extension HttpStatus: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } +extension FileSize: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension SessionId: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } @@ -3935,6 +3985,116 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se #endif } +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt(_: Int.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt(_: UInt.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt8") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt8") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt8(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt8(_: Int8.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt8") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt8") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt8(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt8(_: UInt8.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt16") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt16") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt16(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt16(_: Int16.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt16") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt16") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt16(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt16(_: UInt16.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt32") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt32") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt32(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt32(_: Int32.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt32") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt32") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt32(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt32(_: UInt32.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt64") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt64") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt64(_ v: Int64) -> Int64 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt64(_: Int64.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt64") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt64") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt64(_ v: Int64) -> Int64 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt64(_: UInt64.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalString") @_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalString") public func _bjs_OptionalSupportExports_static_roundTripOptionalString(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { @@ -4034,6 +4194,28 @@ public func _bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum( #endif } +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum(_ vIsSome: Int32, _ vValue: Int64) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalInt64RawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum(_ vIsSome: Int32, _ vValue: Int64) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalUInt64RawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTSEnum") @_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTSEnum") public func _bjs_OptionalSupportExports_static_roundTripOptionalTSEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { @@ -5468,28 +5650,6 @@ public func _bjs_roundTripVoid() -> Void { #endif } -@_expose(wasm, "bjs_roundTripInt") -@_cdecl("bjs_roundTripInt") -public func _bjs_roundTripInt(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = roundTripInt(v: Int.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #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 { @@ -6136,6 +6296,50 @@ public func _bjs_getHttpStatus() -> Int32 { #endif } +@_expose(wasm, "bjs_setFileSize") +@_cdecl("bjs_setFileSize") +public func _bjs_setFileSize(_ size: Int64) -> Int64 { + #if arch(wasm32) + let ret = setFileSize(_: FileSize.bridgeJSLiftParameter(size)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getFileSize") +@_cdecl("bjs_getFileSize") +public func _bjs_getFileSize() -> Int64 { + #if arch(wasm32) + let ret = getFileSize() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setSessionId") +@_cdecl("bjs_setSessionId") +public func _bjs_setSessionId(_ session: Int64) -> Int64 { + #if arch(wasm32) + let ret = setSessionId(_: SessionId.bridgeJSLiftParameter(session)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getSessionId") +@_cdecl("bjs_getSessionId") +public func _bjs_getSessionId() -> Int64 { + #if arch(wasm32) + let ret = getSessionId() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_processTheme") @_cdecl("bjs_processTheme") public func _bjs_processTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Int32 { @@ -11501,6 +11705,235 @@ func _$jsTranslatePoint(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException return Point.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt8_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt16_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt32_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt64_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(_ v: Int64) -> Int64 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(_ v: Int64) -> Int64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static(_ v: Int64) -> Int64 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(_ v: Int64) -> Int64 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(_ v: Int64) -> Int64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static(_ v: Int64) -> Int64 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static") +fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() -> Void +#else +fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static() -> Void { + return bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() +} + +func _$IntegerTypesSupportImports_jsRoundTripInt(_ v: Int) throws(JSException) -> Int { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt(_ v: UInt) throws(JSException) -> UInt { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripInt8(_ v: Int8) throws(JSException) -> Int8 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt8_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int8.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt8(_ v: UInt8) throws(JSException) -> UInt8 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt8.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripInt16(_ v: Int16) throws(JSException) -> Int16 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt16_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int16.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt16(_ v: UInt16) throws(JSException) -> UInt16 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt16.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripInt32(_ v: Int32) throws(JSException) -> Int32 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt32_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int32.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt32(_ v: UInt32) throws(JSException) -> UInt32 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt32.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripInt64(_ v: Int64) throws(JSException) -> Int64 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt64_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int64.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt64(_ v: UInt64) throws(JSException) -> UInt64 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt64.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_runJsIntegerTypesSupportTests() throws(JSException) -> Void { + bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static() + if let error = _swift_js_take_exception() { + throw error + } +} + #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_init") fileprivate func bjs_JSClassWithArrayMembers_init_extern() -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 8a3656b65..cd8111566 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -16,8 +16,11 @@ "label" : "_", "name" : "base", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -31,14 +34,20 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -160,8 +169,11 @@ "label" : "_", "name" : "base", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -175,14 +187,20 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -330,8 +348,11 @@ "label" : "count", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -421,8 +442,11 @@ "isStatic" : false, "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -747,15 +771,21 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -772,8 +802,11 @@ "label" : "a", "name" : "a", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -781,15 +814,21 @@ "label" : "b", "name" : "b", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -862,8 +901,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -888,8 +930,11 @@ "Utils" ], "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1066,8 +1111,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1083,8 +1131,11 @@ "isStatic" : false, "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1104,8 +1155,11 @@ "label" : "intValue", "name" : "intValue", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1191,8 +1245,11 @@ "isStatic" : false, "name" : "intValue", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1241,8 +1298,11 @@ "isStatic" : false, "name" : "readonlyInt", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1321,8 +1381,11 @@ "isStatic" : false, "name" : "computedReadonly", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1341,8 +1404,11 @@ "isStatic" : false, "name" : "observedProperty", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1364,8 +1430,11 @@ "label" : "a", "name" : "a", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1373,15 +1442,21 @@ "label" : "b", "name" : "b", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -1403,8 +1478,11 @@ "label" : "a", "name" : "a", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1412,15 +1490,21 @@ "label" : "b", "name" : "b", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -1478,8 +1562,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1568,8 +1655,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1605,8 +1695,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1665,8 +1758,11 @@ "label" : "_", "name" : "amount", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -1757,8 +1853,11 @@ ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -1793,8 +1892,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1884,8 +1986,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -1907,8 +2012,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -2191,8 +2299,11 @@ "label" : "by", "name" : "amount", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -2215,8 +2326,11 @@ ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -2442,8 +2556,11 @@ "isStatic" : false, "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -2479,8 +2596,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -2808,8 +2928,11 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, { @@ -2946,8 +3069,11 @@ { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -3210,8 +3336,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -3221,8 +3350,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -3367,8 +3499,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -3915,8 +4050,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -4057,8 +4195,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -4068,8 +4209,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -4641,6 +4785,92 @@ } } }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt64RawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt64RawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, { "abiName" : "bjs_ArraySupportExports_static_roundTripStructArray", "effects" : { @@ -4866,8 +5096,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -4882,8 +5115,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -5157,13 +5393,13 @@ } }, { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalStructArray", + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray", "effects" : { "isAsync" : false, "isStatic" : true, "isThrows" : false }, - "name" : "roundTripOptionalStructArray", + "name" : "roundTripOptionalInt64RawValueEnumArray", "namespace" : [ "ArraySupportExports" ], @@ -5176,8 +5412,9 @@ "_0" : { "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" } }, "_1" : "null" @@ -5192,8 +5429,9 @@ "_0" : { "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" } }, "_1" : "null" @@ -5208,13 +5446,13 @@ } }, { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray", + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray", "effects" : { "isAsync" : false, "isStatic" : true, "isThrows" : false }, - "name" : "roundTripOptionalSwiftClassArray", + "name" : "roundTripOptionalUInt64RawValueEnumArray", "namespace" : [ "ArraySupportExports" ], @@ -5227,7 +5465,111 @@ "_0" : { "nullable" : { "_0" : { - "swiftHeapObject" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalStructArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalStructArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalSwiftClassArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { "_0" : "Greeter" } }, @@ -5329,8 +5671,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -5344,8 +5689,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -5670,8 +6018,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -5694,8 +6045,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -5724,8 +6078,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -5780,8 +6137,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -5814,8 +6174,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -5849,8 +6212,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -5971,15 +6337,21 @@ "label" : "count", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -6109,8 +6481,11 @@ "label" : "count", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -6377,8 +6752,11 @@ "label" : "count", "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -6514,8 +6892,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -6523,8 +6904,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -6558,8 +6942,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -6570,8 +6957,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -6628,8 +7018,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -6822,6 +7215,85 @@ { "associatedValues" : [ + ], + "name" : "tiny", + "rawValue" : "1024" + }, + { + "associatedValues" : [ + + ], + "name" : "small", + "rawValue" : "10240" + }, + { + "associatedValues" : [ + + ], + "name" : "medium", + "rawValue" : "102400" + }, + { + "associatedValues" : [ + + ], + "name" : "large", + "rawValue" : "1048576" + } + ], + "emitStyle" : "const", + "name" : "FileSize", + "rawType" : "Int64", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "FileSize", + "tsFullPath" : "FileSize" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "none", + "rawValue" : "0" + }, + { + "associatedValues" : [ + + ], + "name" : "active", + "rawValue" : "9876543210" + }, + { + "associatedValues" : [ + + ], + "name" : "expired", + "rawValue" : "1234567890" + } + ], + "emitStyle" : "const", + "name" : "SessionId", + "rawType" : "UInt64", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "SessionId", + "tsFullPath" : "SessionId" + }, + { + "cases" : [ + { + "associatedValues" : [ + ], "name" : "rough", "rawValue" : "0.1" @@ -7306,8 +7778,11 @@ "associatedValues" : [ { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -7393,8 +7868,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -7438,8 +7916,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -7497,15 +7978,21 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -7605,8 +8092,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -7624,8 +8114,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -7694,8 +8187,11 @@ }, { "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -7773,8 +8269,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -7924,15 +8423,21 @@ "label" : "_", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -8043,15 +8548,21 @@ "label" : "rootId", "name" : "rootId", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -8078,15 +8589,21 @@ "label" : "graphId", "name" : "graphId", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "staticContext" : { @@ -8148,8 +8665,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -8178,8 +8698,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -8193,8 +8716,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -8294,8 +8820,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -8338,8 +8867,412 @@ } } ], - "swiftCallName" : "StaticPropertyNamespace.NestedProperties", - "tsFullPath" : "StaticPropertyNamespace.NestedProperties" + "swiftCallName" : "StaticPropertyNamespace.NestedProperties", + "tsFullPath" : "StaticPropertyNamespace.NestedProperties" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "IntegerTypesSupportExports", + "staticMethods" : [ + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt8", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt8", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt8", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt8", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt16", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt16", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt16", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt16", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt32", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt32", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt32", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt32", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt64", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt64", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt64", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt64", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "IntegerTypesSupportExports", + "tsFullPath" : "IntegerTypesSupportExports" }, { "cases" : [ @@ -8409,8 +9342,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -8421,8 +9357,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -8739,6 +9678,96 @@ } } }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalInt64RawValueEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalUInt64RawValueEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, { "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTSEnum", "effects" : { @@ -8933,8 +9962,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -8949,8 +9981,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -9664,8 +10699,11 @@ "_0" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -9737,8 +10775,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -9778,8 +10819,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -9833,56 +10877,6 @@ } } }, - { - "abiName" : "bjs_roundTripInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripInt", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "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" : { @@ -10197,8 +11191,11 @@ "type" : { "dictionary" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -10208,8 +11205,11 @@ "returnType" : { "dictionary" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -10423,8 +11423,11 @@ ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -10560,15 +11563,21 @@ "label" : "v", "name" : "v", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -10795,8 +11804,11 @@ "label" : "x", "name" : "x", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -10804,15 +11816,21 @@ "label" : "y", "name" : "y", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -10907,128 +11925,218 @@ "isStatic" : false, "isThrows" : false }, - "name" : "getDirection", + "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" : { - "caseEnum" : { - "_0" : "Direction" + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } }, { - "abiName" : "bjs_processDirection", + "abiName" : "bjs_getHttpStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "processDirection", + "name" : "getHttpStatus", "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } + ], "returnType" : { - "caseEnum" : { - "_0" : "Status" + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } }, { - "abiName" : "bjs_setTheme", + "abiName" : "bjs_setFileSize", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "setTheme", + "name" : "setFileSize", "parameters" : [ { "label" : "_", - "name" : "theme", + "name" : "size", "type" : { "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "_0" : "FileSize", + "_1" : "Int64" } } } ], "returnType" : { "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "_0" : "FileSize", + "_1" : "Int64" } } }, { - "abiName" : "bjs_getTheme", + "abiName" : "bjs_getFileSize", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getTheme", + "name" : "getFileSize", "parameters" : [ ], "returnType" : { "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "_0" : "FileSize", + "_1" : "Int64" } } }, { - "abiName" : "bjs_setHttpStatus", + "abiName" : "bjs_setSessionId", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "setHttpStatus", + "name" : "setSessionId", "parameters" : [ { "label" : "_", - "name" : "status", + "name" : "session", "type" : { "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "_0" : "SessionId", + "_1" : "UInt64" } } } ], "returnType" : { "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "_0" : "SessionId", + "_1" : "UInt64" } } }, { - "abiName" : "bjs_getHttpStatus", + "abiName" : "bjs_getSessionId", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getHttpStatus", + "name" : "getSessionId", "parameters" : [ ], "returnType" : { "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "_0" : "SessionId", + "_1" : "UInt64" } } }, @@ -11185,8 +12293,11 @@ "label" : "value", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -11491,8 +12602,11 @@ "label" : "_", "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -11667,8 +12781,11 @@ "label" : "_", "name" : "code", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -11744,8 +12861,11 @@ "label" : "_", "name" : "code", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -11839,8 +12959,11 @@ "label" : "_", "name" : "count1", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -11848,8 +12971,11 @@ "label" : "_", "name" : "count2", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -11969,8 +13095,11 @@ "label" : "_", "name" : "code", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -12003,8 +13132,11 @@ "label" : "_", "name" : "code", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -12071,8 +13203,11 @@ "label" : "_", "name" : "code", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -12196,8 +13331,11 @@ "label" : "intValue", "name" : "intValue", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -12420,8 +13558,11 @@ "label" : "base", "name" : "base", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -12435,14 +13576,20 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -12960,8 +14107,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -12969,8 +14119,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -13029,8 +14182,11 @@ "isReadonly" : false, "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -13051,8 +14207,11 @@ "label" : "by", "name" : "amount", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -13075,8 +14234,11 @@ ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -13301,8 +14463,11 @@ "isReadonly" : false, "name" : "count", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -13335,8 +14500,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -13439,8 +14607,11 @@ "isStatic" : false, "name" : "x", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -13449,8 +14620,11 @@ "isStatic" : false, "name" : "y", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -13637,8 +14811,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -13703,8 +14880,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -13742,8 +14922,11 @@ "label" : "x", "name" : "x", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -13751,8 +14934,11 @@ "label" : "y", "name" : "y", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -13769,8 +14955,11 @@ "isStatic" : false, "name" : "x", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -13779,8 +14968,11 @@ "isStatic" : false, "name" : "y", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -13820,8 +15012,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -13852,8 +15047,11 @@ "isStatic" : false, "name" : "age", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -13971,8 +15169,11 @@ "isStatic" : false, "name" : "id", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14005,8 +15206,11 @@ "isStatic" : false, "name" : "id", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14064,8 +15268,11 @@ "isStatic" : false, "name" : "id", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14445,8 +15652,11 @@ "isStatic" : false, "name" : "x", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14489,8 +15699,11 @@ "isStatic" : false, "name" : "quantity", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -14537,8 +15750,11 @@ "isStatic" : false, "name" : "id", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14591,8 +15807,11 @@ "isStatic" : false, "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14621,8 +15840,11 @@ } }, "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14744,8 +15966,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -14753,8 +15978,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14802,8 +16030,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -14894,8 +16125,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -14903,8 +16137,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -14916,8 +16153,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -14927,8 +16167,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -15100,8 +16343,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -15116,8 +16362,11 @@ "_0" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -15445,8 +16694,11 @@ { "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15461,14 +16713,20 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15478,8 +16736,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15621,8 +16882,11 @@ { "name" : "base", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -15636,14 +16900,20 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15729,8 +16999,11 @@ { "name" : "value", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15745,8 +17018,11 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], @@ -15762,8 +17038,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15781,19 +17060,28 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15803,8 +17091,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15822,24 +17113,36 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15849,8 +17152,11 @@ } ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -15972,8 +17278,11 @@ ], "returnType" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, @@ -16049,8 +17358,11 @@ "type" : { "dictionary" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -16060,8 +17372,11 @@ "returnType" : { "dictionary" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -16820,16 +18135,22 @@ { "name" : "dx", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } }, { "name" : "dy", "type" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -16848,6 +18169,278 @@ { "functions" : [ + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "IntegerTypesSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "name" : "jsRoundTripInt", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "name" : "jsRoundTripUInt", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } + } + } + }, + { + "name" : "jsRoundTripInt8", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + }, + { + "name" : "jsRoundTripUInt8", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + }, + { + "name" : "jsRoundTripInt16", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + }, + { + "name" : "jsRoundTripUInt16", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + }, + { + "name" : "jsRoundTripInt32", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + }, + { + "name" : "jsRoundTripUInt32", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + }, + { + "name" : "jsRoundTripInt64", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + }, + { + "name" : "jsRoundTripUInt64", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + }, + { + "name" : "runJsIntegerTypesSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + ], "types" : [ { @@ -16858,8 +18451,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -16885,8 +18481,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -16914,8 +18513,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -16925,8 +18527,11 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -16989,8 +18594,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -17034,8 +18642,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } @@ -17221,8 +18832,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -17233,8 +18847,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "null" @@ -17249,8 +18866,11 @@ "type" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "undefined" @@ -17261,8 +18881,11 @@ "returnType" : { "nullable" : { "_0" : { - "int" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } }, "_1" : "undefined" diff --git a/Tests/BridgeJSRuntimeTests/IntegerTypesSupportTests.swift b/Tests/BridgeJSRuntimeTests/IntegerTypesSupportTests.swift new file mode 100644 index 000000000..c4ed65d0c --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/IntegerTypesSupportTests.swift @@ -0,0 +1,73 @@ +import JavaScriptKit +import XCTest + +@JSClass struct IntegerTypesSupportImports { + @JSFunction static func jsRoundTripInt(_ v: Int) throws(JSException) -> Int + @JSFunction static func jsRoundTripUInt(_ v: UInt) throws(JSException) -> UInt + @JSFunction static func jsRoundTripInt8(_ v: Int8) throws(JSException) -> Int8 + @JSFunction static func jsRoundTripUInt8(_ v: UInt8) throws(JSException) -> UInt8 + @JSFunction static func jsRoundTripInt16(_ v: Int16) throws(JSException) -> Int16 + @JSFunction static func jsRoundTripUInt16(_ v: UInt16) throws(JSException) -> UInt16 + @JSFunction static func jsRoundTripInt32(_ v: Int32) throws(JSException) -> Int32 + @JSFunction static func jsRoundTripUInt32(_ v: UInt32) throws(JSException) -> UInt32 + @JSFunction static func jsRoundTripInt64(_ v: Int64) throws(JSException) -> Int64 + @JSFunction static func jsRoundTripUInt64(_ v: UInt64) throws(JSException) -> UInt64 + + @JSFunction static func runJsIntegerTypesSupportTests() throws(JSException) -> Void +} + +final class IntegerTypesSupportTests: XCTestCase { + func testRunJsIntegerTypesSupportTests() throws { + try IntegerTypesSupportImports.runJsIntegerTypesSupportTests() + } + + private func roundTripTest(_ fn: (T) throws -> T, _ input: [T]) throws { + for v in input { + let result = try fn(v) + XCTAssertEqual(result, v) + } + } + func testRoundTripInt() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripInt, [0, 1, -1, Int.min, Int.max]) + } + func testRoundTripUInt() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripUInt, [0, 1, UInt.max]) + } + func testRoundTripInt8() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripInt8, [0, 1, -1, Int8.min, Int8.max]) + } + func testRoundTripUInt8() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripUInt8, [0, 1, UInt8.max]) + } + func testRoundTripInt16() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripInt16, [0, 1, -1, Int16.min, Int16.max]) + } + func testRoundTripUInt16() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripUInt16, [0, 1, UInt16.max]) + } + func testRoundTripInt32() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripInt32, [0, 1, -1, Int32.min, Int32.max]) + } + func testRoundTripUInt32() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripUInt32, [0, 1, UInt32.max]) + } + func testRoundTripInt64() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripInt64, [0, 1, -1, Int64.min, Int64.max]) + } + func testRoundTripUInt64() throws { + try roundTripTest(IntegerTypesSupportImports.jsRoundTripUInt64, [0, 1, UInt64.max]) + } +} + +@JS enum IntegerTypesSupportExports { + @JS static func roundTripInt(_ v: Int) -> Int { v } + @JS static func roundTripUInt(_ v: UInt) -> UInt { v } + @JS static func roundTripInt8(_ v: Int8) -> Int8 { v } + @JS static func roundTripUInt8(_ v: UInt8) -> UInt8 { v } + @JS static func roundTripInt16(_ v: Int16) -> Int16 { v } + @JS static func roundTripUInt16(_ v: UInt16) -> UInt16 { v } + @JS static func roundTripInt32(_ v: Int32) -> Int32 { v } + @JS static func roundTripUInt32(_ v: UInt32) -> UInt32 { v } + @JS static func roundTripInt64(_ v: Int64) -> Int64 { v } + @JS static func roundTripUInt64(_ v: UInt64) -> UInt64 { v } +} diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/ArraySupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/ArraySupportTests.mjs index b877e9cf2..29ce274ce 100644 --- a/Tests/BridgeJSRuntimeTests/JavaScript/ArraySupportTests.mjs +++ b/Tests/BridgeJSRuntimeTests/JavaScript/ArraySupportTests.mjs @@ -75,7 +75,7 @@ export function getImports(importsContext) { */ export function runJsArraySupportTests(rootExports) { const exports = rootExports.ArraySupportExports; - const { Direction, Status, Theme, HttpStatus, Greeter, Utils } = rootExports; + const { Direction, Status, Theme, HttpStatus, FileSize, SessionId, Greeter, Utils } = rootExports; // Primitive arrays assert.deepEqual(exports.roundTripIntArray([1, 2, 3, -10, 2147483647]), [1, 2, 3, -10, 2147483647]); @@ -112,6 +112,8 @@ export function runJsArraySupportTests(rootExports) { assert.deepEqual(exports.roundTripCaseEnumArray([Direction.North, Direction.South]), [Direction.North, Direction.South]); assert.deepEqual(exports.roundTripIntRawValueEnumArray([HttpStatus.Ok, HttpStatus.NotFound]), [HttpStatus.Ok, HttpStatus.NotFound]); assert.deepEqual(exports.roundTripStringRawValueEnumArray([Theme.Light, Theme.Dark]), [Theme.Light, Theme.Dark]); + assert.deepEqual(exports.roundTripInt64RawValueEnumArray([FileSize.Tiny, FileSize.Large]), [FileSize.Tiny, FileSize.Large]); + assert.deepEqual(exports.roundTripUInt64RawValueEnumArray([SessionId.None, SessionId.Active]), [SessionId.None, SessionId.Active]); // Struct arrays const points = [ @@ -172,6 +174,8 @@ export function runJsArraySupportTests(rootExports) { assert.equal(optPoints[1], null); assert.deepEqual(exports.roundTripOptionalCaseEnumArray([Direction.North, null]), [Direction.North, null]); assert.deepEqual(exports.roundTripOptionalIntRawValueEnumArray([HttpStatus.Ok, null]), [HttpStatus.Ok, null]); + assert.deepEqual(exports.roundTripOptionalInt64RawValueEnumArray([FileSize.Small, null]), [FileSize.Small, null]); + assert.deepEqual(exports.roundTripOptionalUInt64RawValueEnumArray([SessionId.Expired, null]), [SessionId.Expired, null]); assert.deepEqual(exports.roundTripOptionalJSClassArray([]), []); const optJsClassResult = exports.roundTripOptionalJSClassArray([foo1, null, foo2]); assert.equal(optJsClassResult.length, 3); @@ -205,4 +209,4 @@ export function runJsArraySupportTests(rootExports) { assert.deepEqual(exports.multiOptionalArraySecond(null, ["y"]), ["y"]); assert.deepEqual(exports.multiOptionalArrayFirst([5], null), [5]); assert.equal(exports.multiOptionalArraySecond([5], null), null); -} \ No newline at end of file +} diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/IntegerTypesSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/IntegerTypesSupportTests.mjs new file mode 100644 index 000000000..c66e1adcd --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/JavaScript/IntegerTypesSupportTests.mjs @@ -0,0 +1,175 @@ +// @ts-check + +import assert from 'node:assert'; + +/** + * @returns {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Imports["IntegerTypesSupportImports"]} + */ +export function getImports(importsContext) { + return { + jsRoundTripInt: (v) => { + return v; + }, + jsRoundTripUInt: (v) => { + return v; + }, + jsRoundTripInt8: (v) => { + return v; + }, + jsRoundTripUInt8: (v) => { + return v; + }, + jsRoundTripInt16: (v) => { + return v; + }, + jsRoundTripUInt16: (v) => { + return v; + }, + jsRoundTripInt32: (v) => { + return v; + }, + jsRoundTripUInt32: (v) => { + return v; + }, + jsRoundTripInt64: (v) => { + return v; + }, + jsRoundTripUInt64: (v) => { + return v; + }, + runJsIntegerTypesSupportTests: () => { + const exports = importsContext.getExports(); + if (!exports) { throw new Error("No exports!?"); } + runJsIntegerTypesSupportTests(exports); + }, + } +} + +/** + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} rootExports + */ +export function runJsIntegerTypesSupportTests(rootExports) { + const exports = rootExports.IntegerTypesSupportExports; + const int8Min = -(1 << 7); + const int8Max = (1 << 7) - 1; + const uint8Max = (1 << 8) - 1; + const int16Min = -(1 << 15); + const int16Max = (1 << 15) - 1; + const uint16Max = (1 << 16) - 1; + const int32Min = -(2 ** 31); + const int32Max = (2 ** 31) - 1; + const uint32Max = (2 ** 32) - 1; + const int64Min = -(1n << 63n); + const int64Max = (1n << 63n) - 1n; + const uint64Max = (1n << 64n) - 1n; + + for (const v of [0, 1, -1, int32Min, int32Max]) { + assert.equal(exports.roundTripInt(v), v); + } + for (const v of [0, 1, uint32Max]) { + assert.equal(exports.roundTripUInt(v), v); + } + for (const [v, expected] of [ + [int32Max + 1, int32Min], + [int32Min - 1, int32Max], + ]) { + assert.equal(exports.roundTripInt(v), expected); + } + for (const [v, expected] of [ + [-1, uint32Max], + [uint32Max + 1, 0], + ]) { + assert.equal(exports.roundTripUInt(v), expected); + } + for (const v of [0, 1, -1, int8Min, int8Max]) { + assert.equal(exports.roundTripInt8(v), v); + } + for (const v of [0, 1, uint8Max]) { + assert.equal(exports.roundTripUInt8(v), v); + } + for (const v of [0, 1, -1, int16Min, int16Max]) { + assert.equal(exports.roundTripInt16(v), v); + } + for (const v of [0, 1, uint16Max]) { + assert.equal(exports.roundTripUInt16(v), v); + } + for (const v of [0, 1, -1, int32Min, int32Max]) { + assert.equal(exports.roundTripInt32(v), v); + } + for (const v of [0, 1, uint32Max]) { + assert.equal(exports.roundTripUInt32(v), v); + } + for (const [v, expected] of [ + [int8Max + 1, -128], + [int8Min - 1, 127], + ]) { + assert.equal(exports.roundTripInt8(v), expected); + } + for (const [v, expected] of [ + [-1, 255], + [uint8Max + 1, 0], + ]) { + assert.equal(exports.roundTripUInt8(v), expected); + } + for (const [v, expected] of [ + [int16Max + 1, -32768], + [int16Min - 1, 32767], + ]) { + assert.equal(exports.roundTripInt16(v), expected); + } + for (const [v, expected] of [ + [-1, 65535], + [uint16Max + 1, 0], + ]) { + assert.equal(exports.roundTripUInt16(v), expected); + } + for (const [v, expected] of [ + [int32Max + 1, int32Min], + [int32Min - 1, int32Max], + ]) { + assert.equal(exports.roundTripInt32(v), expected); + } + for (const [v, expected] of [ + [-1, uint32Max], + [uint32Max + 1, 0], + ]) { + assert.equal(exports.roundTripUInt32(v), expected); + } + for (const v of [ + 0n, 1n, -1n, + BigInt(Number.MIN_SAFE_INTEGER), + BigInt(Number.MAX_SAFE_INTEGER), + int64Min, + int64Max, + ]) { + assert.equal(exports.roundTripInt64(v), v); + } + for (const v of [ + 0n, 1n, + BigInt(Number.MAX_SAFE_INTEGER), + uint64Max, + ]) { + assert.equal(exports.roundTripUInt64(v), v); + } + for (const v of [ + int64Max + 1n, + int64Min - 1n, + uint64Max, + uint64Max + 1n, + -(1n << 64n), + (1n << 127n) - 1n, + ]) { + assert.equal(exports.roundTripInt64(v), BigInt.asIntN(64, v)); + } + for (const v of [ + -1n, + -2n, + int64Min, + int64Max, + uint64Max + 1n, + -(1n << 64n), + (1n << 127n) - 1n, + ]) { + assert.equal(exports.roundTripUInt64(v), BigInt.asUintN(64, v)); + } +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs index f9fa397f6..6576876da 100644 --- a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs +++ b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs @@ -5,6 +5,8 @@ import { StatusValues, ThemeValues, HttpStatusValues, + FileSizeValues, + SessionIdValues, TSDirection, TSTheme, APIResultValues, @@ -58,7 +60,7 @@ export function getImports(importsContext) { */ export function runJsOptionalSupportTests(rootExports) { const exports = rootExports.OptionalSupportExports; - const { Status, Theme, HttpStatus, Networking, ComplexResult, APIResult, Greeter, OptionalPropertyHolder, TypedPayloadResult, Direction } = rootExports; + const { Status, Theme, HttpStatus, FileSize, SessionId, Networking, ComplexResult, APIResult, Greeter, OptionalPropertyHolder, TypedPayloadResult, Direction } = rootExports; assert.equal(exports.roundTripOptionalString(null), null); assert.equal(exports.roundTripOptionalInt(null), null); assert.equal(exports.roundTripOptionalBool(null), null); @@ -76,6 +78,8 @@ export function runJsOptionalSupportTests(rootExports) { assert.equal(exports.roundTripOptionalCaseEnum(Status.Success), StatusValues.Success); assert.equal(exports.roundTripOptionalStringRawValueEnum(Theme.Light), ThemeValues.Light); assert.equal(exports.roundTripOptionalIntRawValueEnum(HttpStatus.Ok), HttpStatusValues.Ok); + assert.equal(exports.roundTripOptionalInt64RawValueEnum(FileSize.Tiny), FileSizeValues.Tiny); + assert.equal(exports.roundTripOptionalUInt64RawValueEnum(SessionId.Active), SessionIdValues.Active); assert.equal(exports.roundTripOptionalTSEnum(TSDirection.North), TSDirection.North); assert.equal(exports.roundTripOptionalTSStringEnum(TSTheme.Light), TSTheme.Light); assert.equal(exports.roundTripOptionalNamespacedEnum(Networking.API.Method.Get), Networking.API.Method.Get); diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift index 7f9708f57..3b06901db 100644 --- a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -96,6 +96,8 @@ final class OptionalSupportTests: XCTestCase { @JS static func roundTripOptionalCaseEnum(_ v: Status?) -> Status? { v } @JS static func roundTripOptionalStringRawValueEnum(_ v: Theme?) -> Theme? { v } @JS static func roundTripOptionalIntRawValueEnum(_ v: HttpStatus?) -> HttpStatus? { v } + @JS static func roundTripOptionalInt64RawValueEnum(_ v: FileSize?) -> FileSize? { v } + @JS static func roundTripOptionalUInt64RawValueEnum(_ v: SessionId?) -> SessionId? { v } @JS static func roundTripOptionalTSEnum(_ v: TSDirection?) -> TSDirection? { v } @JS static func roundTripOptionalTSStringEnum(_ v: TSTheme?) -> TSTheme? { v } @JS static func roundTripOptionalNamespacedEnum(_ v: Networking.API.Method?) -> Networking.API.Method? { v } diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index ca2da4324..265781bff 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, PrecisionValues, TypedPayloadResultValues, AllTypesResultValues, OptionalAllTypesResultValues + DirectionValues, StatusValues, ThemeValues, HttpStatusValues, FileSizeValues, SessionIdValues, 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'; @@ -12,6 +12,7 @@ import { getImports as getArraySupportImports, ArrayElementObject } from './Brid import { getImports as getDictionarySupportImports } from './BridgeJSRuntimeTests/JavaScript/DictionarySupportTests.mjs'; import { getImports as getDefaultArgumentImports } from './BridgeJSRuntimeTests/JavaScript/DefaultArgumentTests.mjs'; import { getImports as getJSClassSupportImports, JSClassWithArrayMembers } from './BridgeJSRuntimeTests/JavaScript/JSClassSupportTests.mjs'; +import { getImports as getIntegerTypesSupportImports } from './BridgeJSRuntimeTests/JavaScript/IntegerTypesSupportTests.mjs'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ export async function setupOptions(options, context) { @@ -144,6 +145,7 @@ export async function setupOptions(options, context) { DictionarySupportImports: getDictionarySupportImports(importsContext), DefaultArgumentImports: getDefaultArgumentImports(importsContext), JSClassSupportImports: getJSClassSupportImports(importsContext), + IntegerTypesSupportImports: getIntegerTypesSupportImports(importsContext), }; }, addToCoreImports(importObject, importsContext) { @@ -182,12 +184,6 @@ import assert from "node:assert"; /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { exports.roundTripVoid(); - 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, @@ -534,6 +530,10 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.HttpStatus.NotFound, 404); assert.equal(HttpStatusValues.ServerError, 500); assert.equal(HttpStatusValues.Unknown, -1); + assert.equal(exports.FileSize.Tiny, 1024n); + assert.equal(FileSizeValues.Large, 1048576n); + assert.equal(exports.SessionId.None, 0n); + assert.equal(SessionIdValues.Active, 9876543210n); assert.equal(exports.Precision.Rough, 0.1); assert.equal(exports.Precision.Normal, 0.01); @@ -547,6 +547,10 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.getTheme(), ThemeValues.Light); assert.equal(exports.setHttpStatus(exports.HttpStatus.Ok), HttpStatusValues.Ok); assert.equal(exports.getHttpStatus(), exports.HttpStatus.Ok); + assert.equal(exports.setFileSize(exports.FileSize.Medium), FileSizeValues.Medium); + assert.equal(exports.getFileSize(), FileSizeValues.Small); + assert.equal(exports.setSessionId(exports.SessionId.Expired), SessionIdValues.Expired); + assert.equal(exports.getSessionId(), SessionIdValues.Active); assert.equal(exports.processTheme(exports.Theme.Light), exports.HttpStatus.Ok); assert.equal(exports.processTheme(exports.Theme.Dark), HttpStatusValues.NotFound);