From 0d80ebf1c5a49693705c624094695d63ea095077 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 14:38:47 +0900 Subject: [PATCH] BridgeJS: Split out OptionalSupportTests.swift --- Package.swift | 1 + Package@swift-6.2.swift | 1 + .../BridgeJSRuntimeTests/ExportAPITests.swift | 190 +- .../Generated/BridgeJS.Macros.swift | 4 - .../Generated/BridgeJS.swift | 2748 ++++++----- .../Generated/JavaScript/BridgeJS.json | 4382 +++++++++-------- .../BridgeJSRuntimeTests/ImportAPITests.swift | 20 - .../JavaScript/OptionalSupportTests.mjs | 219 + .../BridgeJSRuntimeTests/JavaScript/Types.mjs | 6 + .../OptionalSupportTests.swift | 232 + Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 2 - Tests/prelude.mjs | 203 +- 12 files changed, 4108 insertions(+), 3900 deletions(-) create mode 100644 Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs create mode 100644 Tests/BridgeJSRuntimeTests/JavaScript/Types.mjs create mode 100644 Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift diff --git a/Package.swift b/Package.swift index 1d4c8fb0..c7f3517e 100644 --- a/Package.swift +++ b/Package.swift @@ -183,6 +183,7 @@ let package = Package( "bridge-js.d.ts", "bridge-js.global.d.ts", "Generated/JavaScript", + "JavaScript", ], swiftSettings: [ .enableExperimentalFeature("Extern") diff --git a/Package@swift-6.2.swift b/Package@swift-6.2.swift index 456a87ca..f640feeb 100644 --- a/Package@swift-6.2.swift +++ b/Package@swift-6.2.swift @@ -194,6 +194,7 @@ let package = Package( "bridge-js.d.ts", "bridge-js.global.d.ts", "Generated/JavaScript", + "JavaScript", ], swiftSettings: [ .enableExperimentalFeature("Extern") diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index fe73ea6f..a41cc302 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -515,123 +515,6 @@ enum ComplexResult { return result } -// MARK: - Optionals - -@JS func roundTripOptionalString(name: String?) -> String? { - return name -} - -@JS func roundTripOptionalInt(value: Int?) -> Int? { - return value -} - -@JS func roundTripOptionalBool(flag: Bool?) -> Bool? { - return flag -} - -@JS func roundTripOptionalFloat(number: Float?) -> Float? { - return number -} - -@JS func roundTripOptionalDouble(precision: Double?) -> Double? { - return precision -} - -@JS func roundTripOptionalSyntax(name: Optional) -> Optional { - return name -} - -@JS func roundTripOptionalMixSyntax(name: String?) -> Optional { - return name -} - -@JS func roundTripOptionalSwiftSyntax(name: Swift.Optional) -> Swift.Optional { - return name -} - -@JS func roundTripOptionalWithSpaces(value: Optional) -> Optional { - return value -} - -typealias OptionalAge = Int? -@JS func roundTripOptionalTypeAlias(age: OptionalAge) -> OptionalAge { - return age -} - -@JS func roundTripOptionalStatus(value: Status?) -> Status? { - return value -} - -@JS func roundTripOptionalTheme(value: Theme?) -> Theme? { - return value -} - -@JS func roundTripOptionalHttpStatus(value: HttpStatus?) -> HttpStatus? { - return value -} - -@JS func roundTripOptionalTSDirection(value: TSDirection?) -> TSDirection? { - return value -} - -@JS func roundTripOptionalTSTheme(value: TSTheme?) -> TSTheme? { - return value -} - -@JS func roundTripOptionalNetworkingAPIMethod(_ method: Networking.API.Method?) -> Networking.API.Method? { - return method -} - -@JS func roundTripOptionalAPIResult(value: APIResult?) -> APIResult? { - return value -} - -@JS enum TypedPayloadResult { - case precision(Precision) - case direction(Direction) - case optPrecision(Precision?) - case optDirection(Direction?) - case empty -} - -@JS func roundTripTypedPayloadResult(_ result: TypedPayloadResult) -> TypedPayloadResult { - return result -} - -@JS func roundTripOptionalTypedPayloadResult(_ result: TypedPayloadResult?) -> TypedPayloadResult? { - return result -} - -@JS func compareAPIResults(_ r1: APIResult?, _ r2: APIResult?) -> String { - let r1Str: String - switch r1 { - case .none: r1Str = "nil" - case .some(.success(let msg)): r1Str = "success:\(msg)" - case .some(.failure(let code)): r1Str = "failure:\(code)" - case .some(.info): r1Str = "info" - case .some(.flag(let b)): r1Str = "flag:\(b)" - case .some(.rate(let r)): r1Str = "rate:\(r)" - case .some(.precise(let p)): r1Str = "precise:\(p)" - } - - let r2Str: String - switch r2 { - case .none: r2Str = "nil" - case .some(.success(let msg)): r2Str = "success:\(msg)" - case .some(.failure(let code)): r2Str = "failure:\(code)" - case .some(.info): r2Str = "info" - case .some(.flag(let b)): r2Str = "flag:\(b)" - case .some(.rate(let r)): r2Str = "rate:\(r)" - case .some(.precise(let p)): r2Str = "precise:\(p)" - } - - return "r1:\(r1Str),r2:\(r2Str)" -} - -@JS func roundTripOptionalComplexResult(_ result: ComplexResult?) -> ComplexResult? { - return result -} - @JS enum AllTypesResult { case structPayload(Address) @@ -644,76 +527,19 @@ enum AllTypesResult { } @JS func roundTripAllTypesResult(_ result: AllTypesResult) -> AllTypesResult { - return result -} - -@JS func roundTripOptionalAllTypesResult(_ result: AllTypesResult?) -> AllTypesResult? { - return result + result } -@JS -enum OptionalAllTypesResult { - case optStruct(Address?) - case optClass(Greeter?) - case optJSObject(JSObject?) - case optNestedEnum(APIResult?) - case optArray([Int]?) - case optJsClass(Foo?) +@JS enum TypedPayloadResult { + case precision(Precision) + case direction(Direction) + case optPrecision(Precision?) + case optDirection(Direction?) case empty } -@JS func roundTripOptionalPayloadResult(_ result: OptionalAllTypesResult) -> OptionalAllTypesResult { - return result -} - -@JS func roundTripOptionalPayloadResultOpt(_ result: OptionalAllTypesResult?) -> OptionalAllTypesResult? { - return result -} - -@JS func roundTripOptionalClass(value: Greeter?) -> Greeter? { - return value -} - -@JS func roundTripOptionalGreeter(_ value: Greeter?) -> Greeter? { - value -} - -@JS func applyOptionalGreeter(_ value: Greeter?, _ transform: (Greeter?) -> Greeter?) -> Greeter? { - transform(value) -} - -@JS class OptionalHolder { - @JS var nullableGreeter: Greeter? - @JS var undefinedNumber: JSUndefinedOr - - @JS init(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) { - self.nullableGreeter = nullableGreeter - self.undefinedNumber = undefinedNumber - } -} - -@JS func makeOptionalHolder(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) -> OptionalHolder { - OptionalHolder(nullableGreeter: nullableGreeter, undefinedNumber: undefinedNumber) -} - -@JS class OptionalPropertyHolder { - @JS var optionalName: String? - @JS var optionalAge: Int? = nil - @JS var optionalGreeter: Greeter? = nil - - @JS init(optionalName: String?) { - self.optionalName = optionalName - } -} - -@JS -enum APIOptionalResult { - case success(String?) - case failure(Int?, Bool?) - case status(Bool?, Int?, String?) -} -@JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult? { - return result +@JS func roundTripTypedPayloadResult(_ result: TypedPayloadResult) -> TypedPayloadResult { + result } // MARK: - Property Tests diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 9e05b3ae..dcaad63f 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -14,10 +14,6 @@ @JSFunction func jsRoundTripString(_ v: String) throws(JSException) -> String -@JSFunction func jsRoundTripOptionalNumberNull(_ v: Optional) throws(JSException) -> Optional - -@JSFunction func jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSException) -> JSUndefinedOr - @JSFunction func jsRoundTripJSValue(_ v: JSValue) throws(JSException) -> JSValue @JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 5638d044..51751dec 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1806,91 +1806,6 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { } } -extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> TypedPayloadResult { - switch caseId { - case 0: - return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) - case 1: - return .direction(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) - case 2: - return .optPrecision(Optional.bridgeJSLiftParameter()) - case 3: - return .optDirection(Optional.bridgeJSLiftParameter()) - case 4: - return .empty - default: - fatalError("Unknown TypedPayloadResult case ID: \(caseId)") - } - } - - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - switch self { - case .precision(let param0): - param0.bridgeJSLowerStackReturn() - return Int32(0) - case .direction(let param0): - param0.bridgeJSLowerStackReturn() - return Int32(1) - case .optPrecision(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(2) - case .optDirection(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(3) - case .empty: - return Int32(4) - } - } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> TypedPayloadResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> TypedPayloadResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .precision(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) - case .direction(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) - case .optPrecision(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(2)) - case .optDirection(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(3)) - case .empty: - _swift_js_push_tag(Int32(4)) - } - } -} - extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> AllTypesResult { switch caseId { @@ -1976,34 +1891,21 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { } } -extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> OptionalAllTypesResult { +extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> TypedPayloadResult { switch caseId { case 0: - return .optStruct(Optional
.bridgeJSLiftParameter()) + return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) case 1: - return .optClass(Optional.bridgeJSLiftParameter()) + return .direction(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .optJSObject(Optional.bridgeJSLiftParameter()) + return .optPrecision(Optional.bridgeJSLiftParameter()) case 3: - return .optNestedEnum(Optional.bridgeJSLiftParameter()) + return .optDirection(Optional.bridgeJSLiftParameter()) case 4: - return .optArray({ - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) - case 5: - return .optJsClass(Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - }) - case 6: return .empty default: - fatalError("Unknown OptionalAllTypesResult case ID: \(caseId)") + fatalError("Unknown TypedPayloadResult case ID: \(caseId)") } } @@ -2011,248 +1913,95 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { - case .optStruct(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + case .precision(let param0): + param0.bridgeJSLowerStackReturn() return Int32(0) - case .optClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + case .direction(let param0): + param0.bridgeJSLowerStackReturn() return Int32(1) - case .optJSObject(let param0): + case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) - case .optNestedEnum(let param0): + case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) - case .optArray(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(4) - case .optJsClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(5) case .empty: - return Int32(6) + return Int32(4) } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> OptionalAllTypesResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> TypedPayloadResult { return _bridgeJSLiftFromCaseId(caseId) } // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> OptionalAllTypesResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> TypedPayloadResult { return _bridgeJSLiftFromCaseId(caseId) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { - case .optStruct(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + case .precision(let param0): + param0.bridgeJSLowerStackReturn() _swift_js_push_tag(Int32(0)) - case .optClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + case .direction(let param0): + param0.bridgeJSLowerStackReturn() _swift_js_push_tag(Int32(1)) - case .optJSObject(let param0): + case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(2)) - case .optNestedEnum(let param0): + case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(3)) - case .optArray(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(4)) - case .optJsClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(5)) case .empty: - _swift_js_push_tag(Int32(6)) + _swift_js_push_tag(Int32(4)) } } } -extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { - switch caseId { +extension StaticCalculator: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> StaticCalculator { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> StaticCalculator { + return StaticCalculator(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { case 0: - return .success(Optional.bridgeJSLiftParameter()) + self = .scientific case 1: - return .failure(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) - case 2: - return .status(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + self = .basic default: - fatalError("Unknown APIOptionalResult case ID: \(caseId)") + return nil } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - switch self { - case .success(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(0) - case .failure(let param0, let param1): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - return Int32(1) - case .status(let param0, let param1, let param2): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - let __bjs_isSome_param2 = param2 != nil - if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) - return Int32(2) - } - } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIOptionalResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(0)) - case .failure(let param0, let param1): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - _swift_js_push_tag(Int32(1)) - case .status(let param0, let param1, let param2): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - let __bjs_isSome_param2 = param2 != nil - if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) - _swift_js_push_tag(Int32(2)) - } - } -} - -extension StaticCalculator: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> StaticCalculator { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> StaticCalculator { - return StaticCalculator(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .scientific - case 1: - self = .basic - default: - return nil - } - } - - private var bridgeJSRawValue: Int32 { + private var bridgeJSRawValue: Int32 { switch self { case .scientific: return 0 @@ -2532,108 +2281,359 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se #endif } -extension Point: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Int.bridgeJSLiftParameter() - let x = Int.bridgeJSLiftParameter() - return Point(x: x, y: y) +extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> OptionalAllTypesResult { + switch caseId { + case 0: + return .optStruct(Optional
.bridgeJSLiftParameter()) + case 1: + return .optClass(Optional.bridgeJSLiftParameter()) + case 2: + return .optJSObject(Optional.bridgeJSLiftParameter()) + case 3: + return .optNestedEnum(Optional.bridgeJSLiftParameter()) + case 4: + return .optArray({ + let __isSome = _swift_js_pop_i32() + if __isSome == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } + }()) + case 5: + return .optJsClass(Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + }) + case 6: + return .empty + default: + fatalError("Unknown OptionalAllTypesResult case ID: \(caseId)") + } } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() - } + // MARK: Protocol Export - init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .optStruct(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(0) + case .optClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(1) + case .optJSObject(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(2) + case .optNestedEnum(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(3) + case .optArray(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(4) + case .optJsClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(5) + case .empty: + return Int32(6) } - self = Self.bridgeJSLiftParameter() } - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> OptionalAllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 -#else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") -fileprivate func _bjs_struct_lift_Point() -> Int32 -#else -fileprivate func _bjs_struct_lift_Point() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif + // MARK: ExportSwift -extension PointerFields: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter() - let ptr = UnsafePointer.bridgeJSLiftParameter() - let opaque = OpaquePointer.bridgeJSLiftParameter() - let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter() - let raw = UnsafeRawPointer.bridgeJSLiftParameter() - return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> OptionalAllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.raw.bridgeJSLowerStackReturn() - self.mutRaw.bridgeJSLowerStackReturn() - self.opaque.bridgeJSLowerStackReturn() - self.ptr.bridgeJSLowerStackReturn() - self.mutPtr.bridgeJSLowerStackReturn() - } - - init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } - self = Self.bridgeJSLiftParameter() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PointerFields())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 -#else -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PointerFields") -fileprivate func _bjs_struct_lift_PointerFields() -> Int32 -#else -fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -@_expose(wasm, "bjs_PointerFields_init") -@_cdecl("bjs_PointerFields_init") -public func _bjs_PointerFields_init(_ raw: UnsafeMutableRawPointer, _ mutRaw: UnsafeMutableRawPointer, _ opaque: UnsafeMutableRawPointer, _ ptr: UnsafeMutableRawPointer, _ mutPtr: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PointerFields(raw: UnsafeRawPointer.bridgeJSLiftParameter(raw), mutRaw: UnsafeMutableRawPointer.bridgeJSLiftParameter(mutRaw), opaque: OpaquePointer.bridgeJSLiftParameter(opaque), ptr: UnsafePointer.bridgeJSLiftParameter(ptr), mutPtr: UnsafeMutablePointer.bridgeJSLiftParameter(mutPtr)) - return ret.bridgeJSLowerReturn() + switch self { + case .optStruct(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(0)) + case .optClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(1)) + case .optJSObject(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + case .optNestedEnum(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(3)) + case .optArray(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(4)) + case .optJsClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(5)) + case .empty: + _swift_js_push_tag(Int32(6)) + } + } +} + +extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { + switch caseId { + case 0: + return .success(Optional.bridgeJSLiftParameter()) + case 1: + return .failure(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + case 2: + return .status(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + default: + fatalError("Unknown APIOptionalResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(0) + case .failure(let param0, let param1): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + return Int32(1) + case .status(let param0, let param1, let param2): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + let __bjs_isSome_param2 = param2 != nil + if let __bjs_unwrapped_param2 = param2 { + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) + return Int32(2) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIOptionalResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .success(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(0)) + case .failure(let param0, let param1): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_tag(Int32(1)) + case .status(let param0, let param1, let param2): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + let __bjs_isSome_param2 = param2 != nil + if let __bjs_unwrapped_param2 = param2 { + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + } + } +} + +extension Point: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { + let y = Int.bridgeJSLiftParameter() + let x = Int.bridgeJSLiftParameter() + return Point(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") +fileprivate func _bjs_struct_lift_Point() -> Int32 +#else +fileprivate func _bjs_struct_lift_Point() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +extension PointerFields: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { + let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter() + let ptr = UnsafePointer.bridgeJSLiftParameter() + let opaque = OpaquePointer.bridgeJSLiftParameter() + let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter() + let raw = UnsafeRawPointer.bridgeJSLiftParameter() + return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.raw.bridgeJSLowerStackReturn() + self.mutRaw.bridgeJSLowerStackReturn() + self.opaque.bridgeJSLowerStackReturn() + self.ptr.bridgeJSLowerStackReturn() + self.mutPtr.bridgeJSLowerStackReturn() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PointerFields())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PointerFields") +fileprivate func _bjs_struct_lift_PointerFields() -> Int32 +#else +fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_PointerFields_init") +@_cdecl("bjs_PointerFields_init") +public func _bjs_PointerFields_init(_ raw: UnsafeMutableRawPointer, _ mutRaw: UnsafeMutableRawPointer, _ opaque: UnsafeMutableRawPointer, _ ptr: UnsafeMutableRawPointer, _ mutPtr: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PointerFields(raw: UnsafeRawPointer.bridgeJSLiftParameter(raw), mutRaw: UnsafeMutableRawPointer.bridgeJSLiftParameter(mutRaw), opaque: OpaquePointer.bridgeJSLiftParameter(opaque), ptr: UnsafePointer.bridgeJSLiftParameter(ptr), mutPtr: UnsafeMutablePointer.bridgeJSLiftParameter(mutPtr)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4654,683 +4654,802 @@ public func _bjs_roundtripAPINetworkingResult(_ result: Int32) -> Void { #endif } -@_expose(wasm, "bjs_roundTripOptionalString") -@_cdecl("bjs_roundTripOptionalString") -public func _bjs_roundTripOptionalString(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalString(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalInt") -@_cdecl("bjs_roundTripOptionalInt") -public func _bjs_roundTripOptionalInt(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalInt(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalBool") -@_cdecl("bjs_roundTripOptionalBool") -public func _bjs_roundTripOptionalBool(_ flagIsSome: Int32, _ flagValue: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalBool(flag: Optional.bridgeJSLiftParameter(flagIsSome, flagValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalFloat") -@_cdecl("bjs_roundTripOptionalFloat") -public func _bjs_roundTripOptionalFloat(_ numberIsSome: Int32, _ numberValue: Float32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalFloat(number: Optional.bridgeJSLiftParameter(numberIsSome, numberValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalDouble") -@_cdecl("bjs_roundTripOptionalDouble") -public func _bjs_roundTripOptionalDouble(_ precisionIsSome: Int32, _ precisionValue: Float64) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalDouble(precision: Optional.bridgeJSLiftParameter(precisionIsSome, precisionValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalSyntax") -@_cdecl("bjs_roundTripOptionalSyntax") -public func _bjs_roundTripOptionalSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripAllTypesResult") +@_cdecl("bjs_roundTripAllTypesResult") +public func _bjs_roundTripAllTypesResult(_ result: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + let ret = roundTripAllTypesResult(_: AllTypesResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalMixSyntax") -@_cdecl("bjs_roundTripOptionalMixSyntax") -public func _bjs_roundTripOptionalMixSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripTypedPayloadResult") +@_cdecl("bjs_roundTripTypedPayloadResult") +public func _bjs_roundTripTypedPayloadResult(_ result: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalMixSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + let ret = roundTripTypedPayloadResult(_: TypedPayloadResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalSwiftSyntax") -@_cdecl("bjs_roundTripOptionalSwiftSyntax") -public func _bjs_roundTripOptionalSwiftSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { +@_expose(wasm, "bjs_createPropertyHolder") +@_cdecl("bjs_createPropertyHolder") +public func _bjs_createPropertyHolder(_ intValue: Int32, _ floatValue: Float32, _ doubleValue: Float64, _ boolValue: Int32, _ stringValueBytes: Int32, _ stringValueLength: Int32, _ jsObject: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripOptionalSwiftSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + let ret = createPropertyHolder(intValue: Int.bridgeJSLiftParameter(intValue), floatValue: Float.bridgeJSLiftParameter(floatValue), doubleValue: Double.bridgeJSLiftParameter(doubleValue), boolValue: Bool.bridgeJSLiftParameter(boolValue), stringValue: String.bridgeJSLiftParameter(stringValueBytes, stringValueLength), jsObject: JSObject.bridgeJSLiftParameter(jsObject)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalWithSpaces") -@_cdecl("bjs_roundTripOptionalWithSpaces") -public func _bjs_roundTripOptionalWithSpaces(_ valueIsSome: Int32, _ valueValue: Float64) -> Void { +@_expose(wasm, "bjs_testPropertyHolder") +@_cdecl("bjs_testPropertyHolder") +public func _bjs_testPropertyHolder(_ holder: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = roundTripOptionalWithSpaces(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + let ret = testPropertyHolder(holder: PropertyHolder.bridgeJSLiftParameter(holder)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTypeAlias") -@_cdecl("bjs_roundTripOptionalTypeAlias") -public func _bjs_roundTripOptionalTypeAlias(_ ageIsSome: Int32, _ ageValue: Int32) -> Void { +@_expose(wasm, "bjs_resetObserverCounts") +@_cdecl("bjs_resetObserverCounts") +public func _bjs_resetObserverCounts() -> Void { #if arch(wasm32) - let ret = roundTripOptionalTypeAlias(age: Optional.bridgeJSLiftParameter(ageIsSome, ageValue)) - return ret.bridgeJSLowerReturn() + resetObserverCounts() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalStatus") -@_cdecl("bjs_roundTripOptionalStatus") -public func _bjs_roundTripOptionalStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +@_expose(wasm, "bjs_getObserverStats") +@_cdecl("bjs_getObserverStats") +public func _bjs_getObserverStats() -> Void { #if arch(wasm32) - let ret = roundTripOptionalStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + let ret = getObserverStats() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTheme") -@_cdecl("bjs_roundTripOptionalTheme") -public func _bjs_roundTripOptionalTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { +@_expose(wasm, "bjs_testStringDefault") +@_cdecl("bjs_testStringDefault") +public func _bjs_testStringDefault(_ messageBytes: Int32, _ messageLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) + let ret = testStringDefault(message: String.bridgeJSLiftParameter(messageBytes, messageLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalHttpStatus") -@_cdecl("bjs_roundTripOptionalHttpStatus") -public func _bjs_roundTripOptionalHttpStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +@_expose(wasm, "bjs_testIntDefault") +@_cdecl("bjs_testIntDefault") +public func _bjs_testIntDefault(_ count: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripOptionalHttpStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + let ret = testIntDefault(count: Int.bridgeJSLiftParameter(count)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTSDirection") -@_cdecl("bjs_roundTripOptionalTSDirection") -public func _bjs_roundTripOptionalTSDirection(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +@_expose(wasm, "bjs_testBoolDefault") +@_cdecl("bjs_testBoolDefault") +public func _bjs_testBoolDefault(_ flag: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripOptionalTSDirection(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + let ret = testBoolDefault(flag: Bool.bridgeJSLiftParameter(flag)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTSTheme") -@_cdecl("bjs_roundTripOptionalTSTheme") -public func _bjs_roundTripOptionalTSTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { +@_expose(wasm, "bjs_testOptionalDefault") +@_cdecl("bjs_testOptionalDefault") +public func _bjs_testOptionalDefault(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalTSTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) + let ret = testOptionalDefault(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalNetworkingAPIMethod") -@_cdecl("bjs_roundTripOptionalNetworkingAPIMethod") -public func _bjs_roundTripOptionalNetworkingAPIMethod(_ methodIsSome: Int32, _ methodValue: Int32) -> Void { +@_expose(wasm, "bjs_testMultipleDefaults") +@_cdecl("bjs_testMultipleDefaults") +public func _bjs_testMultipleDefaults(_ titleBytes: Int32, _ titleLength: Int32, _ count: Int32, _ enabled: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalNetworkingAPIMethod(_: Optional.bridgeJSLiftParameter(methodIsSome, methodValue)) + let ret = testMultipleDefaults(title: String.bridgeJSLiftParameter(titleBytes, titleLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalAPIResult") -@_cdecl("bjs_roundTripOptionalAPIResult") -public func _bjs_roundTripOptionalAPIResult(_ valueIsSome: Int32, _ valueCaseId: Int32) -> Void { +@_expose(wasm, "bjs_testSimpleEnumDefault") +@_cdecl("bjs_testSimpleEnumDefault") +public func _bjs_testSimpleEnumDefault(_ status: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripOptionalAPIResult(value: Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId)) + let ret = testSimpleEnumDefault(status: Status.bridgeJSLiftParameter(status)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripTypedPayloadResult") -@_cdecl("bjs_roundTripTypedPayloadResult") -public func _bjs_roundTripTypedPayloadResult(_ result: Int32) -> Void { +@_expose(wasm, "bjs_testDirectionDefault") +@_cdecl("bjs_testDirectionDefault") +public func _bjs_testDirectionDefault(_ direction: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripTypedPayloadResult(_: TypedPayloadResult.bridgeJSLiftParameter(result)) + let ret = testDirectionDefault(direction: Direction.bridgeJSLiftParameter(direction)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTypedPayloadResult") -@_cdecl("bjs_roundTripOptionalTypedPayloadResult") -public func _bjs_roundTripOptionalTypedPayloadResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_testRawStringEnumDefault") +@_cdecl("bjs_testRawStringEnumDefault") +public func _bjs_testRawStringEnumDefault(_ themeBytes: Int32, _ themeLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + let ret = testRawStringEnumDefault(theme: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_compareAPIResults") -@_cdecl("bjs_compareAPIResults") -public func _bjs_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { +@_expose(wasm, "bjs_testComplexInit") +@_cdecl("bjs_testComplexInit") +public func _bjs_testComplexInit(_ greeter: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let _tmp_r2 = Optional.bridgeJSLiftParameter(r2IsSome, r2CaseId) - let _tmp_r1 = Optional.bridgeJSLiftParameter(r1IsSome, r1CaseId) - let ret = compareAPIResults(_: _tmp_r1, _: _tmp_r2) + let ret = testComplexInit(greeter: Greeter.bridgeJSLiftParameter(greeter)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalComplexResult") -@_cdecl("bjs_roundTripOptionalComplexResult") -public func _bjs_roundTripOptionalComplexResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_testEmptyInit") +@_cdecl("bjs_testEmptyInit") +public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + let ret = testEmptyInit(_: StaticPropertyHolder.bridgeJSLiftParameter(object)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripAllTypesResult") -@_cdecl("bjs_roundTripAllTypesResult") -public func _bjs_roundTripAllTypesResult(_ result: Int32) -> Void { +@_expose(wasm, "bjs_arrayWithDefault") +@_cdecl("bjs_arrayWithDefault") +public func _bjs_arrayWithDefault() -> Int32 { #if arch(wasm32) - let ret = roundTripAllTypesResult(_: AllTypesResult.bridgeJSLiftParameter(result)) + let ret = arrayWithDefault(_: [Int].bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalAllTypesResult") -@_cdecl("bjs_roundTripOptionalAllTypesResult") -public func _bjs_roundTripOptionalAllTypesResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_arrayWithOptionalDefault") +@_cdecl("bjs_arrayWithOptionalDefault") +public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + let ret = arrayWithOptionalDefault(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } + }()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalPayloadResult") -@_cdecl("bjs_roundTripOptionalPayloadResult") -public func _bjs_roundTripOptionalPayloadResult(_ result: Int32) -> Void { +@_expose(wasm, "bjs_arrayMixedDefaults") +@_cdecl("bjs_arrayMixedDefaults") +public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(result)) + let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSLiftParameter(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalPayloadResultOpt") -@_cdecl("bjs_roundTripOptionalPayloadResultOpt") -public func _bjs_roundTripOptionalPayloadResultOpt(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_formatName") +@_cdecl("bjs_formatName") +public func _bjs_formatName(_ nameBytes: Int32, _ nameLength: Int32, _ transform: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + let ret = formatName(_: String.bridgeJSLiftParameter(nameBytes, nameLength), transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalClass") -@_cdecl("bjs_roundTripOptionalClass") -public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_makeFormatter") +@_cdecl("bjs_makeFormatter") +public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripOptionalClass(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - return ret.bridgeJSLowerReturn() + let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) + return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalGreeter") -@_cdecl("bjs_roundTripOptionalGreeter") -public func _bjs_roundTripOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_makeAdder") +@_cdecl("bjs_makeAdder") +public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - return ret.bridgeJSLowerReturn() + let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) + return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_applyOptionalGreeter") -@_cdecl("bjs_applyOptionalGreeter") -public func _bjs_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { +@_expose(wasm, "bjs_roundTripIntArray") +@_cdecl("bjs_roundTripIntArray") +public func _bjs_roundTripIntArray() -> Void { #if arch(wasm32) - let ret = applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() + let ret = roundTripIntArray(_: [Int].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_makeOptionalHolder") -@_cdecl("bjs_makeOptionalHolder") -public func _bjs_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripStringArray") +@_cdecl("bjs_roundTripStringArray") +public func _bjs_roundTripStringArray() -> Void { #if arch(wasm32) - let ret = makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) - return ret.bridgeJSLowerReturn() + let ret = roundTripStringArray(_: [String].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalAPIOptionalResult") -@_cdecl("bjs_roundTripOptionalAPIOptionalResult") -public func _bjs_roundTripOptionalAPIOptionalResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_roundTripDoubleArray") +@_cdecl("bjs_roundTripDoubleArray") +public func _bjs_roundTripDoubleArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalAPIOptionalResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) - return ret.bridgeJSLowerReturn() + let ret = roundTripDoubleArray(_: [Double].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_createPropertyHolder") -@_cdecl("bjs_createPropertyHolder") -public func _bjs_createPropertyHolder(_ intValue: Int32, _ floatValue: Float32, _ doubleValue: Float64, _ boolValue: Int32, _ stringValueBytes: Int32, _ stringValueLength: Int32, _ jsObject: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripBoolArray") +@_cdecl("bjs_roundTripBoolArray") +public func _bjs_roundTripBoolArray() -> Void { #if arch(wasm32) - let ret = createPropertyHolder(intValue: Int.bridgeJSLiftParameter(intValue), floatValue: Float.bridgeJSLiftParameter(floatValue), doubleValue: Double.bridgeJSLiftParameter(doubleValue), boolValue: Bool.bridgeJSLiftParameter(boolValue), stringValue: String.bridgeJSLiftParameter(stringValueBytes, stringValueLength), jsObject: JSObject.bridgeJSLiftParameter(jsObject)) - return ret.bridgeJSLowerReturn() + let ret = roundTripBoolArray(_: [Bool].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testPropertyHolder") -@_cdecl("bjs_testPropertyHolder") -public func _bjs_testPropertyHolder(_ holder: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_roundTripDirectionArray") +@_cdecl("bjs_roundTripDirectionArray") +public func _bjs_roundTripDirectionArray() -> Void { #if arch(wasm32) - let ret = testPropertyHolder(holder: PropertyHolder.bridgeJSLiftParameter(holder)) - return ret.bridgeJSLowerReturn() + let ret = roundTripDirectionArray(_: [Direction].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_resetObserverCounts") -@_cdecl("bjs_resetObserverCounts") -public func _bjs_resetObserverCounts() -> Void { +@_expose(wasm, "bjs_roundTripStatusArray") +@_cdecl("bjs_roundTripStatusArray") +public func _bjs_roundTripStatusArray() -> Void { #if arch(wasm32) - resetObserverCounts() + let ret = roundTripStatusArray(_: [Status].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_getObserverStats") -@_cdecl("bjs_getObserverStats") -public func _bjs_getObserverStats() -> Void { +@_expose(wasm, "bjs_roundTripThemeArray") +@_cdecl("bjs_roundTripThemeArray") +public func _bjs_roundTripThemeArray() -> Void { #if arch(wasm32) - let ret = getObserverStats() - return ret.bridgeJSLowerReturn() + let ret = roundTripThemeArray(_: [Theme].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testStringDefault") -@_cdecl("bjs_testStringDefault") -public func _bjs_testStringDefault(_ messageBytes: Int32, _ messageLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripHttpStatusArray") +@_cdecl("bjs_roundTripHttpStatusArray") +public func _bjs_roundTripHttpStatusArray() -> Void { #if arch(wasm32) - let ret = testStringDefault(message: String.bridgeJSLiftParameter(messageBytes, messageLength)) - return ret.bridgeJSLowerReturn() + let ret = roundTripHttpStatusArray(_: [HttpStatus].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testIntDefault") -@_cdecl("bjs_testIntDefault") -public func _bjs_testIntDefault(_ count: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripDataPointArray") +@_cdecl("bjs_roundTripDataPointArray") +public func _bjs_roundTripDataPointArray() -> Void { #if arch(wasm32) - let ret = testIntDefault(count: Int.bridgeJSLiftParameter(count)) - return ret.bridgeJSLowerReturn() + let ret = roundTripDataPointArray(_: [DataPoint].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testBoolDefault") -@_cdecl("bjs_testBoolDefault") -public func _bjs_testBoolDefault(_ flag: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripGreeterArray") +@_cdecl("bjs_roundTripGreeterArray") +public func _bjs_roundTripGreeterArray() -> Void { #if arch(wasm32) - let ret = testBoolDefault(flag: Bool.bridgeJSLiftParameter(flag)) - return ret.bridgeJSLowerReturn() + let ret = roundTripGreeterArray(_: [Greeter].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testOptionalDefault") -@_cdecl("bjs_testOptionalDefault") -public func _bjs_testOptionalDefault(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalIntArray") +@_cdecl("bjs_roundTripOptionalIntArray") +public func _bjs_roundTripOptionalIntArray() -> Void { #if arch(wasm32) - let ret = testOptionalDefault(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalIntArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testMultipleDefaults") -@_cdecl("bjs_testMultipleDefaults") -public func _bjs_testMultipleDefaults(_ titleBytes: Int32, _ titleLength: Int32, _ count: Int32, _ enabled: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalStringArray") +@_cdecl("bjs_roundTripOptionalStringArray") +public func _bjs_roundTripOptionalStringArray() -> Void { #if arch(wasm32) - let ret = testMultipleDefaults(title: String.bridgeJSLiftParameter(titleBytes, titleLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalStringArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testSimpleEnumDefault") -@_cdecl("bjs_testSimpleEnumDefault") -public func _bjs_testSimpleEnumDefault(_ status: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripOptionalDataPointArray") +@_cdecl("bjs_roundTripOptionalDataPointArray") +public func _bjs_roundTripOptionalDataPointArray() -> Void { #if arch(wasm32) - let ret = testSimpleEnumDefault(status: Status.bridgeJSLiftParameter(status)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalDataPointArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testDirectionDefault") -@_cdecl("bjs_testDirectionDefault") -public func _bjs_testDirectionDefault(_ direction: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripOptionalDirectionArray") +@_cdecl("bjs_roundTripOptionalDirectionArray") +public func _bjs_roundTripOptionalDirectionArray() -> Void { #if arch(wasm32) - let ret = testDirectionDefault(direction: Direction.bridgeJSLiftParameter(direction)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalDirectionArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testRawStringEnumDefault") -@_cdecl("bjs_testRawStringEnumDefault") -public func _bjs_testRawStringEnumDefault(_ themeBytes: Int32, _ themeLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalStatusArray") +@_cdecl("bjs_roundTripOptionalStatusArray") +public func _bjs_roundTripOptionalStatusArray() -> Void { #if arch(wasm32) - let ret = testRawStringEnumDefault(theme: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalStatusArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testComplexInit") -@_cdecl("bjs_testComplexInit") -public func _bjs_testComplexInit(_ greeter: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_roundTripOptionalIntArrayType") +@_cdecl("bjs_roundTripOptionalIntArrayType") +public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { #if arch(wasm32) - let ret = testComplexInit(greeter: Greeter.bridgeJSLiftParameter(greeter)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalIntArrayType(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + __bjs_unwrapped_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testEmptyInit") -@_cdecl("bjs_testEmptyInit") -public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripOptionalStringArrayType") +@_cdecl("bjs_roundTripOptionalStringArrayType") +public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { #if arch(wasm32) - let ret = testEmptyInit(_: StaticPropertyHolder.bridgeJSLiftParameter(object)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalStringArrayType(_: { + if values == 0 { + return Optional<[String]>.none + } else { + return [String].bridgeJSLiftParameter() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + __bjs_unwrapped_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_arrayWithDefault") -@_cdecl("bjs_arrayWithDefault") -public func _bjs_arrayWithDefault() -> Int32 { +@_expose(wasm, "bjs_roundTripOptionalGreeterArrayType") +@_cdecl("bjs_roundTripOptionalGreeterArrayType") +public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { #if arch(wasm32) - let ret = arrayWithDefault(_: [Int].bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalGreeterArrayType(_: { + if greeters == 0 { + return Optional<[Greeter]>.none + } else { + return [Greeter].bridgeJSLiftParameter() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + __bjs_unwrapped_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_arrayWithOptionalDefault") -@_cdecl("bjs_arrayWithOptionalDefault") -public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripNestedIntArray") +@_cdecl("bjs_roundTripNestedIntArray") +public func _bjs_roundTripNestedIntArray() -> Void { #if arch(wasm32) - let ret = arrayWithOptionalDefault(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() + let ret = roundTripNestedIntArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Int]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Int].bridgeJSLiftParameter()) } + __result.reverse() + return __result }()) - return ret.bridgeJSLowerReturn() + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_arrayMixedDefaults") -@_cdecl("bjs_arrayMixedDefaults") -public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripNestedStringArray") +@_cdecl("bjs_roundTripNestedStringArray") +public func _bjs_roundTripNestedStringArray() -> Void { #if arch(wasm32) - let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSLiftParameter(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) - return ret.bridgeJSLowerReturn() + let ret = roundTripNestedStringArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[String]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([String].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_formatName") -@_cdecl("bjs_formatName") -public func _bjs_formatName(_ nameBytes: Int32, _ nameLength: Int32, _ transform: Int32) -> Void { +@_expose(wasm, "bjs_roundTripNestedDoubleArray") +@_cdecl("bjs_roundTripNestedDoubleArray") +public func _bjs_roundTripNestedDoubleArray() -> Void { #if arch(wasm32) - let ret = formatName(_: String.bridgeJSLiftParameter(nameBytes, nameLength), transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() + let ret = roundTripNestedDoubleArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Double]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Double].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_makeFormatter") -@_cdecl("bjs_makeFormatter") -public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripNestedBoolArray") +@_cdecl("bjs_roundTripNestedBoolArray") +public func _bjs_roundTripNestedBoolArray() -> Void { #if arch(wasm32) - let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) - return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) + let ret = roundTripNestedBoolArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Bool]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Bool].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_makeAdder") -@_cdecl("bjs_makeAdder") -public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripNestedDataPointArray") +@_cdecl("bjs_roundTripNestedDataPointArray") +public func _bjs_roundTripNestedDataPointArray() -> Void { #if arch(wasm32) - let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) - return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(ret) + let ret = roundTripNestedDataPointArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[DataPoint]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([DataPoint].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripIntArray") -@_cdecl("bjs_roundTripIntArray") -public func _bjs_roundTripIntArray() -> Void { +@_expose(wasm, "bjs_roundTripNestedDirectionArray") +@_cdecl("bjs_roundTripNestedDirectionArray") +public func _bjs_roundTripNestedDirectionArray() -> Void { #if arch(wasm32) - let ret = roundTripIntArray(_: [Int].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedDirectionArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Direction]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Direction].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripStringArray") -@_cdecl("bjs_roundTripStringArray") -public func _bjs_roundTripStringArray() -> Void { +@_expose(wasm, "bjs_roundTripNestedGreeterArray") +@_cdecl("bjs_roundTripNestedGreeterArray") +public func _bjs_roundTripNestedGreeterArray() -> Void { #if arch(wasm32) - let ret = roundTripStringArray(_: [String].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedGreeterArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Greeter]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Greeter].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripDoubleArray") -@_cdecl("bjs_roundTripDoubleArray") -public func _bjs_roundTripDoubleArray() -> Void { +@_expose(wasm, "bjs_roundTripUnsafeRawPointerArray") +@_cdecl("bjs_roundTripUnsafeRawPointerArray") +public func _bjs_roundTripUnsafeRawPointerArray() -> Void { #if arch(wasm32) - let ret = roundTripDoubleArray(_: [Double].bridgeJSLiftParameter()) + let ret = roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripBoolArray") -@_cdecl("bjs_roundTripBoolArray") -public func _bjs_roundTripBoolArray() -> Void { +@_expose(wasm, "bjs_roundTripUnsafeMutableRawPointerArray") +@_cdecl("bjs_roundTripUnsafeMutableRawPointerArray") +public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) - let ret = roundTripBoolArray(_: [Bool].bridgeJSLiftParameter()) + let ret = roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripDirectionArray") -@_cdecl("bjs_roundTripDirectionArray") -public func _bjs_roundTripDirectionArray() -> Void { +@_expose(wasm, "bjs_roundTripOpaquePointerArray") +@_cdecl("bjs_roundTripOpaquePointerArray") +public func _bjs_roundTripOpaquePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripDirectionArray(_: [Direction].bridgeJSLiftParameter()) + let ret = roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripStatusArray") -@_cdecl("bjs_roundTripStatusArray") -public func _bjs_roundTripStatusArray() -> Void { +@_expose(wasm, "bjs_roundTripUnsafePointerArray") +@_cdecl("bjs_roundTripUnsafePointerArray") +public func _bjs_roundTripUnsafePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripStatusArray(_: [Status].bridgeJSLiftParameter()) + let ret = roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripThemeArray") -@_cdecl("bjs_roundTripThemeArray") -public func _bjs_roundTripThemeArray() -> Void { +@_expose(wasm, "bjs_roundTripUnsafeMutablePointerArray") +@_cdecl("bjs_roundTripUnsafeMutablePointerArray") +public func _bjs_roundTripUnsafeMutablePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripThemeArray(_: [Theme].bridgeJSLiftParameter()) + let ret = roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripHttpStatusArray") -@_cdecl("bjs_roundTripHttpStatusArray") -public func _bjs_roundTripHttpStatusArray() -> Void { +@_expose(wasm, "bjs_consumeDataProcessorArrayType") +@_cdecl("bjs_consumeDataProcessorArrayType") +public func _bjs_consumeDataProcessorArrayType() -> Int32 { #if arch(wasm32) - let ret = roundTripHttpStatusArray(_: [HttpStatus].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = consumeDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripDataPointArray") -@_cdecl("bjs_roundTripDataPointArray") -public func _bjs_roundTripDataPointArray() -> Void { +@_expose(wasm, "bjs_roundTripDataProcessorArrayType") +@_cdecl("bjs_roundTripDataProcessorArrayType") +public func _bjs_roundTripDataProcessorArrayType() -> Void { #if arch(wasm32) - let ret = roundTripDataPointArray(_: [DataPoint].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) + ret.map { + $0 as! AnyDataProcessor + } .bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripGreeterArray") -@_cdecl("bjs_roundTripGreeterArray") -public func _bjs_roundTripGreeterArray() -> Void { +@_expose(wasm, "bjs_roundTripJSObjectArray") +@_cdecl("bjs_roundTripJSObjectArray") +public func _bjs_roundTripJSObjectArray() -> Void { #if arch(wasm32) - let ret = roundTripGreeterArray(_: [Greeter].bridgeJSLiftParameter()) + let ret = roundTripJSObjectArray(_: [JSObject].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalIntArray") -@_cdecl("bjs_roundTripOptionalIntArray") -public func _bjs_roundTripOptionalIntArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalJSObjectArray") +@_cdecl("bjs_roundTripOptionalJSObjectArray") +public func _bjs_roundTripOptionalJSObjectArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalIntArray(_: { + let ret = roundTripOptionalJSObjectArray(_: { let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] + var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -5346,41 +5465,40 @@ public func _bjs_roundTripOptionalIntArray() -> Void { #endif } -@_expose(wasm, "bjs_roundTripOptionalStringArray") -@_cdecl("bjs_roundTripOptionalStringArray") -public func _bjs_roundTripOptionalStringArray() -> Void { +@_expose(wasm, "bjs_roundTripFooArray") +@_cdecl("bjs_roundTripFooArray") +public func _bjs_roundTripFooArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalStringArray(_: { + let ret = roundTripFooArray(_: { let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] + var __result: [Foo] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) } __result.reverse() return __result }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + ret.map { + $0.jsObject + } .bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalDataPointArray") -@_cdecl("bjs_roundTripOptionalDataPointArray") -public func _bjs_roundTripOptionalDataPointArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalFooArray") +@_cdecl("bjs_roundTripOptionalFooArray") +public func _bjs_roundTripOptionalFooArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalDataPointArray(_: { + let ret = roundTripOptionalFooArray(_: { let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] + var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + }) } __result.reverse() return __result @@ -5388,7 +5506,7 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} + __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -5396,429 +5514,311 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { #endif } -@_expose(wasm, "bjs_roundTripOptionalDirectionArray") -@_cdecl("bjs_roundTripOptionalDirectionArray") -public func _bjs_roundTripOptionalDirectionArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalString") +@_cdecl("bjs_roundTripOptionalString") +public func _bjs_roundTripOptionalString(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalDirectionArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalString(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalStatusArray") -@_cdecl("bjs_roundTripOptionalStatusArray") -public func _bjs_roundTripOptionalStatusArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalInt") +@_cdecl("bjs_roundTripOptionalInt") +public func _bjs_roundTripOptionalInt(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalStatusArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalInt(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalIntArrayType") -@_cdecl("bjs_roundTripOptionalIntArrayType") -public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalBool") +@_cdecl("bjs_roundTripOptionalBool") +public func _bjs_roundTripOptionalBool(_ flagIsSome: Int32, _ flagValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalIntArrayType(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalBool(flag: Optional.bridgeJSLiftParameter(flagIsSome, flagValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalFloat") +@_cdecl("bjs_roundTripOptionalFloat") +public func _bjs_roundTripOptionalFloat(_ numberIsSome: Int32, _ numberValue: Float32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalFloat(number: Optional.bridgeJSLiftParameter(numberIsSome, numberValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalDouble") +@_cdecl("bjs_roundTripOptionalDouble") +public func _bjs_roundTripOptionalDouble(_ precisionIsSome: Int32, _ precisionValue: Float64) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalDouble(precision: Optional.bridgeJSLiftParameter(precisionIsSome, precisionValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalSyntax") +@_cdecl("bjs_roundTripOptionalSyntax") +public func _bjs_roundTripOptionalSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalMixSyntax") +@_cdecl("bjs_roundTripOptionalMixSyntax") +public func _bjs_roundTripOptionalMixSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalMixSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalSwiftSyntax") +@_cdecl("bjs_roundTripOptionalSwiftSyntax") +public func _bjs_roundTripOptionalSwiftSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalSwiftSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalStringArrayType") -@_cdecl("bjs_roundTripOptionalStringArrayType") -public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalWithSpaces") +@_cdecl("bjs_roundTripOptionalWithSpaces") +public func _bjs_roundTripOptionalWithSpaces(_ valueIsSome: Int32, _ valueValue: Float64) -> Void { #if arch(wasm32) - let ret = roundTripOptionalStringArrayType(_: { - if values == 0 { - return Optional<[String]>.none - } else { - return [String].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalWithSpaces(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalGreeterArrayType") -@_cdecl("bjs_roundTripOptionalGreeterArrayType") -public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalTypeAlias") +@_cdecl("bjs_roundTripOptionalTypeAlias") +public func _bjs_roundTripOptionalTypeAlias(_ ageIsSome: Int32, _ ageValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalGreeterArrayType(_: { - if greeters == 0 { - return Optional<[Greeter]>.none - } else { - return [Greeter].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalTypeAlias(age: Optional.bridgeJSLiftParameter(ageIsSome, ageValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedIntArray") -@_cdecl("bjs_roundTripNestedIntArray") -public func _bjs_roundTripNestedIntArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalStatus") +@_cdecl("bjs_roundTripOptionalStatus") +public func _bjs_roundTripOptionalStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Int]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Int].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedStringArray") -@_cdecl("bjs_roundTripNestedStringArray") -public func _bjs_roundTripNestedStringArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalTheme") +@_cdecl("bjs_roundTripOptionalTheme") +public func _bjs_roundTripOptionalTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedStringArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[String]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([String].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedDoubleArray") -@_cdecl("bjs_roundTripNestedDoubleArray") -public func _bjs_roundTripNestedDoubleArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalHttpStatus") +@_cdecl("bjs_roundTripOptionalHttpStatus") +public func _bjs_roundTripOptionalHttpStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedDoubleArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Double]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Double].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalHttpStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedBoolArray") -@_cdecl("bjs_roundTripNestedBoolArray") -public func _bjs_roundTripNestedBoolArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalTSDirection") +@_cdecl("bjs_roundTripOptionalTSDirection") +public func _bjs_roundTripOptionalTSDirection(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedBoolArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Bool]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Bool].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalTSDirection(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedDataPointArray") -@_cdecl("bjs_roundTripNestedDataPointArray") -public func _bjs_roundTripNestedDataPointArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalTSTheme") +@_cdecl("bjs_roundTripOptionalTSTheme") +public func _bjs_roundTripOptionalTSTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedDataPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[DataPoint]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([DataPoint].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalTSTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedDirectionArray") -@_cdecl("bjs_roundTripNestedDirectionArray") -public func _bjs_roundTripNestedDirectionArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalNetworkingAPIMethod") +@_cdecl("bjs_roundTripOptionalNetworkingAPIMethod") +public func _bjs_roundTripOptionalNetworkingAPIMethod(_ methodIsSome: Int32, _ methodValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedDirectionArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Direction]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Direction].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalNetworkingAPIMethod(_: Optional.bridgeJSLiftParameter(methodIsSome, methodValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedGreeterArray") -@_cdecl("bjs_roundTripNestedGreeterArray") -public func _bjs_roundTripNestedGreeterArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalAPIResult") +@_cdecl("bjs_roundTripOptionalAPIResult") +public func _bjs_roundTripOptionalAPIResult(_ valueIsSome: Int32, _ valueCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedGreeterArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Greeter]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Greeter].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalAPIResult(value: Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripUnsafeRawPointerArray") -@_cdecl("bjs_roundTripUnsafeRawPointerArray") -public func _bjs_roundTripUnsafeRawPointerArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalTypedPayloadResult") +@_cdecl("bjs_roundTripOptionalTypedPayloadResult") +public func _bjs_roundTripOptionalTypedPayloadResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripUnsafeMutableRawPointerArray") -@_cdecl("bjs_roundTripUnsafeMutableRawPointerArray") -public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { +@_expose(wasm, "bjs_compareAPIResults") +@_cdecl("bjs_compareAPIResults") +public func _bjs_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let _tmp_r2 = Optional.bridgeJSLiftParameter(r2IsSome, r2CaseId) + let _tmp_r1 = Optional.bridgeJSLiftParameter(r1IsSome, r1CaseId) + let ret = compareAPIResults(_: _tmp_r1, _: _tmp_r2) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOpaquePointerArray") -@_cdecl("bjs_roundTripOpaquePointerArray") -public func _bjs_roundTripOpaquePointerArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalComplexResult") +@_cdecl("bjs_roundTripOptionalComplexResult") +public func _bjs_roundTripOptionalComplexResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripUnsafePointerArray") -@_cdecl("bjs_roundTripUnsafePointerArray") -public func _bjs_roundTripUnsafePointerArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalAllTypesResult") +@_cdecl("bjs_roundTripOptionalAllTypesResult") +public func _bjs_roundTripOptionalAllTypesResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripUnsafeMutablePointerArray") -@_cdecl("bjs_roundTripUnsafeMutablePointerArray") -public func _bjs_roundTripUnsafeMutablePointerArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalPayloadResult") +@_cdecl("bjs_roundTripOptionalPayloadResult") +public func _bjs_roundTripOptionalPayloadResult(_ result: Int32) -> Void { #if arch(wasm32) - let ret = roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_consumeDataProcessorArrayType") -@_cdecl("bjs_consumeDataProcessorArrayType") -public func _bjs_consumeDataProcessorArrayType() -> Int32 { +@_expose(wasm, "bjs_roundTripOptionalPayloadResultOpt") +@_cdecl("bjs_roundTripOptionalPayloadResultOpt") +public func _bjs_roundTripOptionalPayloadResultOpt(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = consumeDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) + let ret = roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripDataProcessorArrayType") -@_cdecl("bjs_roundTripDataProcessorArrayType") -public func _bjs_roundTripDataProcessorArrayType() -> Void { - #if arch(wasm32) - let ret = roundTripDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) - ret.map { - $0 as! AnyDataProcessor - } .bridgeJSLowerReturn() +@_expose(wasm, "bjs_roundTripOptionalClass") +@_cdecl("bjs_roundTripOptionalClass") +public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalClass(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripJSObjectArray") -@_cdecl("bjs_roundTripJSObjectArray") -public func _bjs_roundTripJSObjectArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalGreeter") +@_cdecl("bjs_roundTripOptionalGreeter") +public func _bjs_roundTripOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = roundTripJSObjectArray(_: [JSObject].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalJSObjectArray") -@_cdecl("bjs_roundTripOptionalJSObjectArray") -public func _bjs_roundTripOptionalJSObjectArray() -> Void { +@_expose(wasm, "bjs_applyOptionalGreeter") +@_cdecl("bjs_applyOptionalGreeter") +public func _bjs_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalJSObjectArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripFooArray") -@_cdecl("bjs_roundTripFooArray") -public func _bjs_roundTripFooArray() -> Void { +@_expose(wasm, "bjs_makeOptionalHolder") +@_cdecl("bjs_makeOptionalHolder") +public func _bjs_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripFooArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Foo] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) - } - __result.reverse() - return __result - }()) - ret.map { - $0.jsObject - } .bridgeJSLowerReturn() + let ret = makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalFooArray") -@_cdecl("bjs_roundTripOptionalFooArray") -public func _bjs_roundTripOptionalFooArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalAPIOptionalResult") +@_cdecl("bjs_roundTripOptionalAPIOptionalResult") +public func _bjs_roundTripOptionalAPIOptionalResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalFooArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - }) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalAPIOptionalResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6299,302 +6299,125 @@ public func _bjs_Converter_init() -> UnsafeMutableRawPointer { public func _bjs_Converter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) let ret = Utils.Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Converter_deinit") -@_cdecl("bjs_Converter_deinit") -public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -@_expose(wasm, "bjs_HTTPServer_init") -@_cdecl("bjs_HTTPServer_init") -public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = Networking.API.HTTPServer() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_HTTPServer_call") -@_cdecl("bjs_HTTPServer_call") -public func _bjs_HTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { - #if arch(wasm32) - Networking.API.HTTPServer.bridgeJSLiftParameter(_self).call(_: Networking.API.Method.bridgeJSLiftParameter(method)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_HTTPServer_deinit") -@_cdecl("bjs_HTTPServer_deinit") -public func _bjs_HTTPServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_HTTPServer_wrap") -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -@_expose(wasm, "bjs_TestServer_init") -@_cdecl("bjs_TestServer_init") -public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = Internal.TestServer() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TestServer_call") -@_cdecl("bjs_TestServer_call") -public func _bjs_TestServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { - #if arch(wasm32) - Internal.TestServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TestServer_deinit") -@_cdecl("bjs_TestServer_deinit") -public func _bjs_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TestServer_wrap") -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -@_expose(wasm, "bjs_OptionalHolder_init") -@_cdecl("bjs_OptionalHolder_init") -public func _bjs_OptionalHolder_init(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = OptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_nullableGreeter_get") -@_cdecl("bjs_OptionalHolder_nullableGreeter_get") -public func _bjs_OptionalHolder_nullableGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_nullableGreeter_set") -@_cdecl("bjs_OptionalHolder_nullableGreeter_set") -public func _bjs_OptionalHolder_nullableGreeter_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_undefinedNumber_get") -@_cdecl("bjs_OptionalHolder_undefinedNumber_get") -public func _bjs_OptionalHolder_undefinedNumber_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_undefinedNumber_set") -@_cdecl("bjs_OptionalHolder_undefinedNumber_set") -public func _bjs_OptionalHolder_undefinedNumber_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { - #if arch(wasm32) - OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber = JSUndefinedOr.bridgeJSLiftParameter(valueIsSome, valueValue) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_OptionalHolder_deinit") -@_cdecl("bjs_OptionalHolder_deinit") -public func _bjs_OptionalHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_Converter_deinit") +@_cdecl("bjs_Converter_deinit") +public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -extension OptionalHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { +extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalHolder_wrap") -fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Converter_wrap") +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif -@_expose(wasm, "bjs_OptionalPropertyHolder_init") -@_cdecl("bjs_OptionalPropertyHolder_init") -public func _bjs_OptionalPropertyHolder_init(_ optionalNameIsSome: Int32, _ optionalNameBytes: Int32, _ optionalNameLength: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_HTTPServer_init") +@_cdecl("bjs_HTTPServer_init") +public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = OptionalPropertyHolder(optionalName: Optional.bridgeJSLiftParameter(optionalNameIsSome, optionalNameBytes, optionalNameLength)) + let ret = Networking.API.HTTPServer() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_get") -@_cdecl("bjs_OptionalPropertyHolder_optionalName_get") -public func _bjs_OptionalPropertyHolder_optionalName_get(_ _self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_HTTPServer_call") +@_cdecl("bjs_HTTPServer_call") +public func _bjs_HTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) - let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName - return ret.bridgeJSLowerReturn() + Networking.API.HTTPServer.bridgeJSLiftParameter(_self).call(_: Networking.API.Method.bridgeJSLiftParameter(method)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_set") -@_cdecl("bjs_OptionalPropertyHolder_optionalName_set") -public func _bjs_OptionalPropertyHolder_optionalName_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { +@_expose(wasm, "bjs_HTTPServer_deinit") +@_cdecl("bjs_HTTPServer_deinit") +public func _bjs_HTTPServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_get") -@_cdecl("bjs_OptionalPropertyHolder_optionalAge_get") -public func _bjs_OptionalPropertyHolder_optionalAge_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif +extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) + } } -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_set") -@_cdecl("bjs_OptionalPropertyHolder_optionalAge_set") -public func _bjs_OptionalPropertyHolder_optionalAge_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_HTTPServer_wrap") +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") - #endif } +#endif -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_get") -@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_get") -public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_TestServer_init") +@_cdecl("bjs_TestServer_init") +public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter + let ret = Internal.TestServer() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_set") -@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_set") -public func _bjs_OptionalPropertyHolder_optionalGreeter_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_TestServer_call") +@_cdecl("bjs_TestServer_call") +public func _bjs_TestServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) - OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + Internal.TestServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_OptionalPropertyHolder_deinit") -@_cdecl("bjs_OptionalPropertyHolder_deinit") -public func _bjs_OptionalPropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_TestServer_deinit") +@_cdecl("bjs_TestServer_deinit") +public func _bjs_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { +extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + return .object(JSObject(id: UInt32(bitPattern: _bjs_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) } } #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TestServer_wrap") +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -8147,181 +7970,358 @@ public func _bjs_TextProcessor_processOptionalGreeter(_ _self: UnsafeMutableRawP #endif } -@_expose(wasm, "bjs_TextProcessor_makeOptionalStringFormatter") -@_cdecl("bjs_TextProcessor_makeOptionalStringFormatter") -public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_TextProcessor_makeOptionalStringFormatter") +@_cdecl("bjs_TextProcessor_makeOptionalStringFormatter") +public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() + return _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") +@_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") +public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() + return _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processDirection") +@_cdecl("bjs_TextProcessor_processDirection") +public func _bjs_TextProcessor_processDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processTheme") +@_cdecl("bjs_TextProcessor_processTheme") +public func _bjs_TextProcessor_processTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processHttpStatus") +@_cdecl("bjs_TextProcessor_processHttpStatus") +public func _bjs_TextProcessor_processHttpStatus(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processAPIResult") +@_cdecl("bjs_TextProcessor_processAPIResult") +public func _bjs_TextProcessor_processAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeDirectionChecker") +@_cdecl("bjs_TextProcessor_makeDirectionChecker") +public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() + return _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeThemeValidator") +@_cdecl("bjs_TextProcessor_makeThemeValidator") +public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() + return _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeStatusCodeExtractor") +@_cdecl("bjs_TextProcessor_makeStatusCodeExtractor") +public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() + return _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeAPIResultHandler") +@_cdecl("bjs_TextProcessor_makeAPIResultHandler") +public func _bjs_TextProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() + return _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalDirection") +@_cdecl("bjs_TextProcessor_processOptionalDirection") +public func _bjs_TextProcessor_processOptionalDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalTheme") +@_cdecl("bjs_TextProcessor_processOptionalTheme") +public func _bjs_TextProcessor_processOptionalTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalAPIResult") +@_cdecl("bjs_TextProcessor_processOptionalAPIResult") +public func _bjs_TextProcessor_processOptionalAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeOptionalDirectionFormatter") +@_cdecl("bjs_TextProcessor_makeOptionalDirectionFormatter") +public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() + return _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_deinit") +@_cdecl("bjs_TextProcessor_deinit") +public func _bjs_TextProcessor_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() - return _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLower(ret) + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") -@_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") -public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") +fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_OptionalHolder_init") +@_cdecl("bjs_OptionalHolder_init") +public func _bjs_OptionalHolder_init(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() - return _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC.bridgeJSLower(ret) + let ret = OptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_processDirection") -@_cdecl("bjs_TextProcessor_processDirection") -public func _bjs_TextProcessor_processDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_OptionalHolder_nullableGreeter_get") +@_cdecl("bjs_OptionalHolder_nullableGreeter_get") +public func _bjs_OptionalHolder_nullableGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS.bridgeJSLift(callback)) + let ret = OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_processTheme") -@_cdecl("bjs_TextProcessor_processTheme") -public func _bjs_TextProcessor_processTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_OptionalHolder_nullableGreeter_set") +@_cdecl("bjs_OptionalHolder_nullableGreeter_set") +public func _bjs_OptionalHolder_nullableGreeter_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_processHttpStatus") -@_cdecl("bjs_TextProcessor_processHttpStatus") -public func _bjs_TextProcessor_processHttpStatus(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Int32 { +@_expose(wasm, "bjs_OptionalHolder_undefinedNumber_get") +@_cdecl("bjs_OptionalHolder_undefinedNumber_get") +public func _bjs_OptionalHolder_undefinedNumber_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLift(callback)) + let ret = OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_processAPIResult") -@_cdecl("bjs_TextProcessor_processAPIResult") -public func _bjs_TextProcessor_processAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_OptionalHolder_undefinedNumber_set") +@_cdecl("bjs_OptionalHolder_undefinedNumber_set") +public func _bjs_OptionalHolder_undefinedNumber_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber = JSUndefinedOr.bridgeJSLiftParameter(valueIsSome, valueValue) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeDirectionChecker") -@_cdecl("bjs_TextProcessor_makeDirectionChecker") -public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_OptionalHolder_deinit") +@_cdecl("bjs_OptionalHolder_deinit") +public func _bjs_OptionalHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() - return _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb.bridgeJSLower(ret) + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeThemeValidator") -@_cdecl("bjs_TextProcessor_makeThemeValidator") -public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +extension OptionalHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalHolder_wrap") +fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_OptionalPropertyHolder_init") +@_cdecl("bjs_OptionalPropertyHolder_init") +public func _bjs_OptionalPropertyHolder_init(_ optionalNameIsSome: Int32, _ optionalNameBytes: Int32, _ optionalNameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() - return _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb.bridgeJSLower(ret) + let ret = OptionalPropertyHolder(optionalName: Optional.bridgeJSLiftParameter(optionalNameIsSome, optionalNameBytes, optionalNameLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeStatusCodeExtractor") -@_cdecl("bjs_TextProcessor_makeStatusCodeExtractor") -public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_get") +@_cdecl("bjs_OptionalPropertyHolder_optionalName_get") +public func _bjs_OptionalPropertyHolder_optionalName_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() - return _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLower(ret) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeAPIResultHandler") -@_cdecl("bjs_TextProcessor_makeAPIResultHandler") -public func _bjs_TextProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_set") +@_cdecl("bjs_OptionalPropertyHolder_optionalName_set") +public func _bjs_OptionalPropertyHolder_optionalName_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() - return _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLower(ret) + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_processOptionalDirection") -@_cdecl("bjs_TextProcessor_processOptionalDirection") -public func _bjs_TextProcessor_processOptionalDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_get") +@_cdecl("bjs_OptionalPropertyHolder_optionalAge_get") +public func _bjs_OptionalPropertyHolder_optionalAge_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLift(callback)) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_processOptionalTheme") -@_cdecl("bjs_TextProcessor_processOptionalTheme") -public func _bjs_TextProcessor_processOptionalTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_set") +@_cdecl("bjs_OptionalPropertyHolder_optionalAge_set") +public func _bjs_OptionalPropertyHolder_optionalAge_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_processOptionalAPIResult") -@_cdecl("bjs_TextProcessor_processOptionalAPIResult") -public func _bjs_TextProcessor_processOptionalAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_get") +@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_get") +public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS.bridgeJSLift(callback)) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeOptionalDirectionFormatter") -@_cdecl("bjs_TextProcessor_makeOptionalDirectionFormatter") -public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_set") +@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_set") +public func _bjs_OptionalPropertyHolder_optionalGreeter_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() - return _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLower(ret) + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_deinit") -@_cdecl("bjs_TextProcessor_deinit") -public func _bjs_TextProcessor_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_OptionalPropertyHolder_deinit") +@_cdecl("bjs_OptionalPropertyHolder_deinit") +public func _bjs_OptionalPropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { +extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } } #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") -fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -8529,42 +8529,6 @@ func _$jsRoundTripString(_ v: String) throws(JSException) -> String { return String.bridgeJSLiftReturn(ret) } -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberNull") -fileprivate func bjs_jsRoundTripOptionalNumberNull(_ vIsSome: Int32, _ vValue: Float64) -> Void -#else -fileprivate func bjs_jsRoundTripOptionalNumberNull(_ vIsSome: Int32, _ vValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsRoundTripOptionalNumberNull(_ v: Optional) throws(JSException) -> Optional { - let (vIsSome, vValue) = v.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalNumberNull(vIsSome, vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Optional.bridgeJSLiftReturnFromSideChannel() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberUndefined") -fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsSome: Int32, _ vValue: Float64) -> Void -#else -fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsSome: Int32, _ vValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { - let (vIsSome, vValue) = v.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalNumberUndefined(vIsSome, vValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() -} - #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripJSValue") fileprivate func bjs_jsRoundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void @@ -9540,4 +9504,92 @@ func _$jsTranslatePoint(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException throw error } return Point.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runJsOptionalSupportTests") +fileprivate func bjs_runJsOptionalSupportTests() -> Void +#else +fileprivate func bjs_runJsOptionalSupportTests() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$runJsOptionalSupportTests() throws(JSException) -> Void { + bjs_runJsOptionalSupportTests() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberNull") +fileprivate func bjs_jsRoundTripOptionalNumberNull(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalNumberNull(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalNumberNull(_ value: Optional) throws(JSException) -> Optional { + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalNumberNull(valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberUndefined") +fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalNumberUndefined(valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalStringNull") +fileprivate func bjs_jsRoundTripOptionalStringNull(_ nameIsSome: Int32, _ nameValue: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalStringNull(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalStringNull(_ name: Optional) throws(JSException) -> Optional { + let (nameIsSome, nameValue) = name.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalStringNull(nameIsSome, nameValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalStringUndefined") +fileprivate func bjs_jsRoundTripOptionalStringUndefined(_ nameIsSome: Int32, _ nameValue: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalStringUndefined(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let (nameIsSome, nameValue) = name.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalStringUndefined(nameIsSome, nameValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 36611579..01d47b5a 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -525,161 +525,6 @@ ], "swiftCallName" : "Internal.TestServer" }, - { - "constructor" : { - "abiName" : "bjs_OptionalHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "nullableGreeter", - "name" : "nullableGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "undefinedNumber", - "name" : "undefinedNumber", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "OptionalHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "nullableGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "undefinedNumber", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - } - ], - "swiftCallName" : "OptionalHolder" - }, - { - "constructor" : { - "abiName" : "bjs_OptionalPropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "optionalName", - "name" : "optionalName", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "OptionalPropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalName", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalAge", - "type" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "OptionalPropertyHolder" - }, { "constructor" : { "abiName" : "bjs_SimplePropertyHolder_init", @@ -3241,7 +3086,7 @@ }, { "constructor" : { - "abiName" : "bjs_Container_init", + "abiName" : "bjs_OptionalHolder_init", "effects" : { "isAsync" : false, "isStatic" : false, @@ -3249,25 +3094,30 @@ }, "parameters" : [ { - "label" : "location", - "name" : "location", + "label" : "nullableGreeter", + "name" : "nullableGreeter", "type" : { - "swiftStruct" : { - "_0" : "DataPoint" + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" } } }, { - "label" : "config", - "name" : "config", + "label" : "undefinedNumber", + "name" : "undefinedNumber", "type" : { "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "Config" + "double" : { + } }, - "_1" : "null" + "_1" : "undefined" } } } @@ -3276,51 +3126,201 @@ "methods" : [ ], - "name" : "Container", + "name" : "OptionalHolder", "properties" : [ { "isReadonly" : false, "isStatic" : false, - "name" : "location", + "name" : "nullableGreeter", "type" : { - "swiftStruct" : { - "_0" : "DataPoint" + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" } } }, { "isReadonly" : false, "isStatic" : false, - "name" : "config", + "name" : "undefinedNumber", "type" : { "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "Config" + "double" : { + } }, - "_1" : "null" + "_1" : "undefined" } } } ], - "swiftCallName" : "Container" - } - ], - "enums" : [ + "swiftCallName" : "OptionalHolder" + }, { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "north" + "constructor" : { + "abiName" : "bjs_OptionalPropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false }, + "parameters" : [ + { + "label" : "optionalName", + "name" : "optionalName", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "OptionalPropertyHolder", + "properties" : [ { - "associatedValues" : [ + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalName", + "type" : { + "nullable" : { + "_0" : { + "string" : { - ], - "name" : "south" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalAge", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalGreeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "OptionalPropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_Container_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "location", + "name" : "location", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "label" : "config", + "name" : "config", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + }, + "_1" : "null" + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "Container", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "location", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "config", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "Container" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" }, { "associatedValues" : [ @@ -4357,86 +4357,6 @@ "swiftCallName" : "API.NetworkingResult", "tsFullPath" : "API.NetworkingResult" }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - } - ], - "name" : "precision" - }, - { - "associatedValues" : [ - { - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "name" : "direction" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optPrecision" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optDirection" - }, - { - "associatedValues" : [ - - ], - "name" : "empty" - } - ], - "emitStyle" : "const", - "name" : "TypedPayloadResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TypedPayloadResult", - "tsFullPath" : "TypedPayloadResult" - }, { "cases" : [ { @@ -4539,35 +4459,26 @@ "associatedValues" : [ { "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "Address" - } - }, - "_1" : "null" + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" } } } ], - "name" : "optStruct" + "name" : "precision" }, { "associatedValues" : [ { "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Direction" } } } ], - "name" : "optClass" + "name" : "direction" }, { "associatedValues" : [ @@ -4575,8 +4486,9 @@ "type" : { "nullable" : { "_0" : { - "jsObject" : { - + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" } }, "_1" : "null" @@ -4584,7 +4496,7 @@ } } ], - "name" : "optJSObject" + "name" : "optPrecision" }, { "associatedValues" : [ @@ -4592,8 +4504,8 @@ "type" : { "nullable" : { "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "caseEnum" : { + "_0" : "Direction" } }, "_1" : "null" @@ -4601,45 +4513,7 @@ } } ], - "name" : "optNestedEnum" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optArray" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optJsClass" + "name" : "optDirection" }, { "associatedValues" : [ @@ -4649,116 +4523,15 @@ } ], "emitStyle" : "const", - "name" : "OptionalAllTypesResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "OptionalAllTypesResult", - "tsFullPath" : "OptionalAllTypesResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "APIOptionalResult", + "name" : "TypedPayloadResult", "staticMethods" : [ ], "staticProperties" : [ ], - "swiftCallName" : "APIOptionalResult", - "tsFullPath" : "APIOptionalResult" + "swiftCallName" : "TypedPayloadResult", + "tsFullPath" : "TypedPayloadResult" }, { "cases" : [ @@ -5207,274 +4980,501 @@ ], "swiftCallName" : "StaticPropertyNamespace.NestedProperties", "tsFullPath" : "StaticPropertyNamespace.NestedProperties" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_roundTripVoid", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } }, { - "abiName" : "bjs_roundTripInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripInt", - "parameters" : [ + "cases" : [ { - "label" : "v", - "name" : "v", - "type" : { - "int" : { - + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_roundTripUInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUInt", - "parameters" : [ + ], + "name" : "optStruct" + }, { - "label" : "v", - "name" : "v", - "type" : { - "uint" : { - + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "uint" : { - - } - } - }, - { - "abiName" : "bjs_roundTripFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripFloat", - "parameters" : [ + ], + "name" : "optClass" + }, { - "label" : "v", - "name" : "v", - "type" : { - "float" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDouble", - "parameters" : [ + ], + "name" : "optJSObject" + }, { - "label" : "v", - "name" : "v", - "type" : { - "double" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optNestedEnum" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + } + } + } + }, + "_1" : "null" + } + } } - } + ], + "name" : "optArray" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optJsClass" + }, + { + "associatedValues" : [ + + ], + "name" : "empty" } ], - "returnType" : { - "double" : { + "emitStyle" : "const", + "name" : "OptionalAllTypesResult", + "staticMethods" : [ - } - } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "OptionalAllTypesResult", + "tsFullPath" : "OptionalAllTypesResult" }, { - "abiName" : "bjs_roundTripBool", + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "status" + } + ], + "emitStyle" : "const", + "name" : "APIOptionalResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIOptionalResult", + "tsFullPath" : "APIOptionalResult" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundTripVoid", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripBool", + "name" : "roundTripVoid", "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "bool" : { - } - } - } ], "returnType" : { - "bool" : { + "void" : { } } }, { - "abiName" : "bjs_roundTripString", + "abiName" : "bjs_roundTripInt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripString", + "name" : "roundTripInt", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "string" : { + "int" : { } } } ], "returnType" : { - "string" : { + "int" : { } } }, { - "abiName" : "bjs_roundTripSwiftHeapObject", + "abiName" : "bjs_roundTripUInt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripSwiftHeapObject", + "name" : "roundTripUInt", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "uint" : { + } } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "uint" : { + } } }, { - "abiName" : "bjs_roundTripUnsafeRawPointer", + "abiName" : "bjs_roundTripFloat", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeRawPointer", + "name" : "roundTripFloat", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } + "float" : { + } } } ], "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } + "float" : { + } } }, { - "abiName" : "bjs_roundTripUnsafeMutableRawPointer", + "abiName" : "bjs_roundTripDouble", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeMutableRawPointer", + "name" : "roundTripDouble", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } + "double" : { + } } } ], "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } + "double" : { + } } }, { - "abiName" : "bjs_roundTripOpaquePointer", + "abiName" : "bjs_roundTripBool", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOpaquePointer", + "name" : "roundTripBool", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "unsafePointer" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_roundTripString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripString", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_roundTripSwiftHeapObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripSwiftHeapObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeRawPointer", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeMutableRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutableRawPointer", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + }, + { + "abiName" : "bjs_roundTripOpaquePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOpaquePointer", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { "_0" : { "kind" : "opaquePointer" } @@ -7259,445 +7259,296 @@ } }, { - "abiName" : "bjs_roundTripOptionalString", + "abiName" : "bjs_roundTripAllTypesResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalString", + "name" : "roundTripAllTypesResult", "parameters" : [ { - "label" : "name", - "name" : "name", + "label" : "_", + "name" : "result", "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "AllTypesResult" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "AllTypesResult" } } }, { - "abiName" : "bjs_roundTripOptionalInt", + "abiName" : "bjs_roundTripTypedPayloadResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalInt", + "name" : "roundTripTypedPayloadResult", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "result", "type" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } } }, { - "abiName" : "bjs_roundTripOptionalBool", + "abiName" : "bjs_createPropertyHolder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalBool", + "name" : "createPropertyHolder", "parameters" : [ { - "label" : "flag", - "name" : "flag", + "label" : "intValue", + "name" : "intValue", "type" : { - "nullable" : { - "_0" : { - "bool" : { + "int" : { - } - }, - "_1" : "null" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "bool" : { + }, + { + "label" : "floatValue", + "name" : "floatValue", + "type" : { + "float" : { } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalFloat", - "parameters" : [ + } + }, { - "label" : "number", - "name" : "number", + "label" : "doubleValue", + "name" : "doubleValue", "type" : { - "nullable" : { - "_0" : { - "float" : { + "double" : { - } - }, - "_1" : "null" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "float" : { + }, + { + "label" : "boolValue", + "name" : "boolValue", + "type" : { + "bool" : { } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalDouble", - "parameters" : [ + } + }, { - "label" : "precision", - "name" : "precision", + "label" : "stringValue", + "name" : "stringValue", "type" : { - "nullable" : { - "_0" : { - "double" : { + "string" : { - } - }, - "_1" : "null" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalSyntax", - "parameters" : [ + }, { - "label" : "name", - "name" : "name", + "label" : "jsObject", + "name" : "jsObject", "type" : { - "nullable" : { - "_0" : { - "string" : { + "jsObject" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "PropertyHolder" } } }, { - "abiName" : "bjs_roundTripOptionalMixSyntax", + "abiName" : "bjs_testPropertyHolder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalMixSyntax", + "name" : "testPropertyHolder", "parameters" : [ { - "label" : "name", - "name" : "name", + "label" : "holder", + "name" : "holder", "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "PropertyHolder" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { + "string" : { - } - }, - "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalSwiftSyntax", + "abiName" : "bjs_resetObserverCounts", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalSwiftSyntax", + "name" : "resetObserverCounts", "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "nullable" : { - "_0" : { - "string" : { - } - }, - "_1" : "null" - } - } - } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { + "void" : { - } - }, - "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalWithSpaces", + "abiName" : "bjs_getObserverStats", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalWithSpaces", + "name" : "getObserverStats", "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "double" : { - } - }, - "_1" : "null" - } - } - } ], "returnType" : { - "nullable" : { - "_0" : { - "double" : { + "string" : { - } - }, - "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalTypeAlias", + "abiName" : "bjs_testStringDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTypeAlias", + "name" : "testStringDefault", "parameters" : [ { - "label" : "age", - "name" : "age", + "defaultValue" : { + "string" : { + "_0" : "Hello World" + } + }, + "label" : "message", + "name" : "message", "type" : { - "nullable" : { - "_0" : { - "int" : { + "string" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "int" : { + "string" : { - } - }, - "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalStatus", + "abiName" : "bjs_testIntDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStatus", + "name" : "testIntDefault", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "int" : { + "_0" : 42 + } + }, + "label" : "count", + "name" : "count", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "int" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "int" : { + } } }, { - "abiName" : "bjs_roundTripOptionalTheme", + "abiName" : "bjs_testBoolDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTheme", + "name" : "testBoolDefault", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "flag", + "name" : "flag", "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" + "bool" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" + "bool" : { + } } }, { - "abiName" : "bjs_roundTripOptionalHttpStatus", + "abiName" : "bjs_testOptionalDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalHttpStatus", + "name" : "testOptionalDefault", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "null" : { + + } + }, + "label" : "name", + "name" : "name", "type" : { "nullable" : { "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "string" : { + } }, "_1" : "null" @@ -7708,9 +7559,8 @@ "returnType" : { "nullable" : { "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "string" : { + } }, "_1" : "null" @@ -7718,530 +7568,671 @@ } }, { - "abiName" : "bjs_roundTripOptionalTSDirection", + "abiName" : "bjs_testMultipleDefaults", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTSDirection", + "name" : "testMultipleDefaults", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "string" : { + "_0" : "Default Title" + } + }, + "label" : "title", + "name" : "title", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - }, - "_1" : "null" + "string" : { + } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" + }, + { + "defaultValue" : { + "int" : { + "_0" : -10 } }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTSTheme", - "parameters" : [ + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, { - "label" : "value", - "name" : "value", + "defaultValue" : { + "bool" : { + "_0" : false + } + }, + "label" : "enabled", + "name" : "enabled", "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - }, - "_1" : "null" + "bool" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - }, - "_1" : "null" + "string" : { + } } }, { - "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", + "abiName" : "bjs_testSimpleEnumDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalNetworkingAPIMethod", + "name" : "testSimpleEnumDefault", "parameters" : [ { - "label" : "_", - "name" : "method", + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "success" + } + }, + "label" : "status", + "name" : "status", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Status" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Status" } } }, { - "abiName" : "bjs_roundTripOptionalAPIResult", + "abiName" : "bjs_testDirectionDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAPIResult", + "name" : "testDirectionDefault", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "enumCase" : { + "_0" : "Direction", + "_1" : "north" + } + }, + "label" : "direction", + "name" : "direction", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Direction" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Direction" } } }, { - "abiName" : "bjs_roundTripTypedPayloadResult", + "abiName" : "bjs_testRawStringEnumDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripTypedPayloadResult", + "name" : "testRawStringEnumDefault", "parameters" : [ { - "label" : "_", - "name" : "result", + "defaultValue" : { + "enumCase" : { + "_0" : "Theme", + "_1" : "light" + } + }, + "label" : "theme", + "name" : "theme", "type" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } }, { - "abiName" : "bjs_roundTripOptionalTypedPayloadResult", + "abiName" : "bjs_testComplexInit", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTypedPayloadResult", + "name" : "testComplexInit", "parameters" : [ { - "label" : "_", - "name" : "result", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" + "defaultValue" : { + "objectWithArguments" : { + "_0" : "Greeter", + "_1" : [ + { + "string" : { + "_0" : "DefaultGreeter" + } } - }, - "_1" : "null" + ] + } + }, + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - }, - "_1" : "null" + "string" : { + } } }, { - "abiName" : "bjs_compareAPIResults", + "abiName" : "bjs_testEmptyInit", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "compareAPIResults", + "name" : "testEmptyInit", "parameters" : [ { - "label" : "_", - "name" : "r1", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "defaultValue" : { + "object" : { + "_0" : "StaticPropertyHolder" } - } - }, - { + }, "label" : "_", - "name" : "r2", + "name" : "object", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" } } } ], "returnType" : { - "string" : { - + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" } } }, { - "abiName" : "bjs_roundTripOptionalComplexResult", + "abiName" : "bjs_arrayWithDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalComplexResult", + "name" : "arrayWithDefault", "parameters" : [ { - "label" : "_", - "name" : "result", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - }, - "_1" : "null" + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 1 + } + }, + { + "int" : { + "_0" : 2 + } + }, + { + "int" : { + "_0" : 3 + } + } + ] + } + }, + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "int" : { + + } + } + }, + { + "abiName" : "bjs_arrayWithOptionalDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "arrayWithOptionalDefault", + "parameters" : [ + { + "defaultValue" : { + "null" : { + } }, - "_1" : "null" + "label" : "_", + "name" : "values", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "int" : { + } } }, { - "abiName" : "bjs_roundTripAllTypesResult", + "abiName" : "bjs_arrayMixedDefaults", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripAllTypesResult", + "name" : "arrayMixedDefaults", "parameters" : [ { - "label" : "_", - "name" : "result", + "defaultValue" : { + "string" : { + "_0" : "Sum" + } + }, + "label" : "prefix", + "name" : "prefix", "type" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "string" : { + + } + } + }, + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 10 + } + }, + { + "int" : { + "_0" : 20 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "defaultValue" : { + "string" : { + "_0" : "!" + } + }, + "label" : "suffix", + "name" : "suffix", + "type" : { + "string" : { + } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "string" : { + } } }, { - "abiName" : "bjs_roundTripOptionalAllTypesResult", + "abiName" : "bjs_formatName", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAllTypesResult", + "name" : "formatName", "parameters" : [ { "label" : "_", - "name" : "result", + "name" : "name", "type" : { - "nullable" : { + "string" : { + + } + } + }, + { + "label" : "transform", + "name" : "transform", + "type" : { + "closure" : { "_0" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_makeFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFormatter", + "parameters" : [ + { + "label" : "prefix", + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { "_0" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_roundTripOptionalPayloadResult", + "abiName" : "bjs_makeAdder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalPayloadResult", + "name" : "makeAdder", + "parameters" : [ + { + "label" : "base", + "name" : "base", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripIntArray", "parameters" : [ { "label" : "_", - "name" : "result", + "name" : "values", "type" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "array" : { + "_0" : { + "int" : { + + } + } } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "array" : { + "_0" : { + "int" : { + + } + } } } }, { - "abiName" : "bjs_roundTripOptionalPayloadResultOpt", + "abiName" : "bjs_roundTripStringArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalPayloadResultOpt", + "name" : "roundTripStringArray", "parameters" : [ { "label" : "_", - "name" : "result", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "string" : { + } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "string" : { + } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_roundTripOptionalClass", + "abiName" : "bjs_roundTripDoubleArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalClass", + "name" : "roundTripDoubleArray", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "double" : { + } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "double" : { + } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_roundTripOptionalGreeter", + "abiName" : "bjs_roundTripBoolArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalGreeter", + "name" : "roundTripBoolArray", "parameters" : [ { "label" : "_", - "name" : "value", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "bool" : { + } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "bool" : { + } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_applyOptionalGreeter", + "abiName" : "bjs_roundTripDirectionArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "applyOptionalGreeter", + "name" : "roundTripDirectionArray", "parameters" : [ { "label" : "_", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "_", - "name" : "transform", + "name" : "values", "type" : { - "closure" : { + "array" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } + "caseEnum" : { + "_0" : "Direction" } } } @@ -8249,336 +8240,420 @@ } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "caseEnum" : { + "_0" : "Direction" } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_makeOptionalHolder", + "abiName" : "bjs_roundTripStatusArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeOptionalHolder", + "name" : "roundTripStatusArray", "parameters" : [ { - "label" : "nullableGreeter", - "name" : "nullableGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "undefinedNumber", - "name" : "undefinedNumber", + "label" : "_", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "double" : { - + "caseEnum" : { + "_0" : "Status" } - }, - "_1" : "undefined" + } } } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "OptionalHolder" + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } } } }, { - "abiName" : "bjs_roundTripOptionalAPIOptionalResult", + "abiName" : "bjs_roundTripThemeArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAPIOptionalResult", + "name" : "roundTripThemeArray", "parameters" : [ { - "label" : "result", - "name" : "result", + "label" : "_", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_createPropertyHolder", + "abiName" : "bjs_roundTripHttpStatusArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "createPropertyHolder", + "name" : "roundTripHttpStatusArray", "parameters" : [ { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "label" : "floatValue", - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "label" : "doubleValue", - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "label" : "boolValue", - "name" : "boolValue", + "label" : "_", + "name" : "values", "type" : { - "bool" : { - + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } } } - }, - { - "label" : "stringValue", - "name" : "stringValue", - "type" : { - "string" : { - + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } - }, + } + } + }, + { + "abiName" : "bjs_roundTripDataPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDataPointArray", + "parameters" : [ { - "label" : "jsObject", - "name" : "jsObject", + "label" : "_", + "name" : "points", "type" : { - "jsObject" : { - + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } } } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "PropertyHolder" + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } } } }, { - "abiName" : "bjs_testPropertyHolder", + "abiName" : "bjs_roundTripGreeterArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testPropertyHolder", + "name" : "roundTripGreeterArray", "parameters" : [ { - "label" : "holder", - "name" : "holder", + "label" : "_", + "name" : "greeters", "type" : { - "swiftHeapObject" : { - "_0" : "PropertyHolder" + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } } } } ], "returnType" : { - "string" : { - + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } } } }, { - "abiName" : "bjs_resetObserverCounts", + "abiName" : "bjs_roundTripOptionalIntArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "resetObserverCounts", + "name" : "roundTripOptionalIntArray", "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "int" : { + } + }, + "_1" : "null" + } + } + } + } + } ], "returnType" : { - "void" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "int" : { + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_getObserverStats", + "abiName" : "bjs_roundTripOptionalStringArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getObserverStats", + "name" : "roundTripOptionalStringArray", "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "null" + } + } + } + } + } ], "returnType" : { - "string" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_testStringDefault", + "abiName" : "bjs_roundTripOptionalDataPointArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testStringDefault", + "name" : "roundTripOptionalDataPointArray", "parameters" : [ { - "defaultValue" : { - "string" : { - "_0" : "Hello World" - } - }, - "label" : "message", - "name" : "message", + "label" : "_", + "name" : "points", "type" : { - "string" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } } } } ], "returnType" : { - "string" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_testIntDefault", + "abiName" : "bjs_roundTripOptionalDirectionArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testIntDefault", + "name" : "roundTripOptionalDirectionArray", "parameters" : [ { - "defaultValue" : { - "int" : { - "_0" : 42 - } - }, - "label" : "count", - "name" : "count", + "label" : "_", + "name" : "directions", "type" : { - "int" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } } } } ], "returnType" : { - "int" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_testBoolDefault", + "abiName" : "bjs_roundTripOptionalStatusArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testBoolDefault", + "name" : "roundTripOptionalStatusArray", "parameters" : [ { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "flag", - "name" : "flag", + "label" : "_", + "name" : "statuses", "type" : { - "bool" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "_1" : "null" + } + } } } } ], "returnType" : { - "bool" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_testOptionalDefault", + "abiName" : "bjs_roundTripOptionalIntArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testOptionalDefault", - "parameters" : [ - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "name", - "name" : "name", + "name" : "roundTripOptionalIntArrayType", + "parameters" : [ + { + "label" : "_", + "name" : "values", "type" : { "nullable" : { "_0" : { - "string" : { + "array" : { + "_0" : { + "int" : { + } + } } }, "_1" : "null" @@ -8589,8 +8664,12 @@ "returnType" : { "nullable" : { "_0" : { - "string" : { + "array" : { + "_0" : { + "int" : { + } + } } }, "_1" : "null" @@ -8598,263 +8677,235 @@ } }, { - "abiName" : "bjs_testMultipleDefaults", + "abiName" : "bjs_roundTripOptionalStringArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testMultipleDefaults", + "name" : "roundTripOptionalStringArrayType", "parameters" : [ { - "defaultValue" : { - "string" : { - "_0" : "Default Title" - } - }, - "label" : "title", - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : -10 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : false - } - }, - "label" : "enabled", - "name" : "enabled", + "label" : "_", + "name" : "values", "type" : { - "bool" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + } + } + } + }, + "_1" : "null" } } } ], "returnType" : { - "string" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + } + } + } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_testSimpleEnumDefault", + "abiName" : "bjs_roundTripOptionalGreeterArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testSimpleEnumDefault", + "name" : "roundTripOptionalGreeterArrayType", "parameters" : [ { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "success" - } - }, - "label" : "status", - "name" : "status", + "label" : "_", + "name" : "greeters", "type" : { - "caseEnum" : { - "_0" : "Status" + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "_1" : "null" } } } ], "returnType" : { - "caseEnum" : { - "_0" : "Status" + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_testDirectionDefault", + "abiName" : "bjs_roundTripNestedIntArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testDirectionDefault", + "name" : "roundTripNestedIntArray", "parameters" : [ { - "defaultValue" : { - "enumCase" : { - "_0" : "Direction", - "_1" : "north" - } - }, - "label" : "direction", - "name" : "direction", + "label" : "_", + "name" : "values", "type" : { - "caseEnum" : { - "_0" : "Direction" + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } } } } ], "returnType" : { - "caseEnum" : { - "_0" : "Direction" + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } } } }, { - "abiName" : "bjs_testRawStringEnumDefault", + "abiName" : "bjs_roundTripNestedStringArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testRawStringEnumDefault", + "name" : "roundTripNestedStringArray", "parameters" : [ { - "defaultValue" : { - "enumCase" : { - "_0" : "Theme", - "_1" : "light" - } - }, - "label" : "theme", - "name" : "theme", + "label" : "_", + "name" : "values", "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } } } } ], "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } } } }, { - "abiName" : "bjs_testComplexInit", + "abiName" : "bjs_roundTripNestedDoubleArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testComplexInit", + "name" : "roundTripNestedDoubleArray", "parameters" : [ { - "defaultValue" : { - "objectWithArguments" : { - "_0" : "Greeter", - "_1" : [ - { - "string" : { - "_0" : "DefaultGreeter" + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } } } - ] - } - }, - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" + } } } } ], "returnType" : { - "string" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "double" : { - } - } - }, - { - "abiName" : "bjs_testEmptyInit", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testEmptyInit", - "parameters" : [ - { - "defaultValue" : { - "object" : { - "_0" : "StaticPropertyHolder" - } - }, - "label" : "_", - "name" : "object", - "type" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" + } + } } } } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" - } } }, { - "abiName" : "bjs_arrayWithDefault", + "abiName" : "bjs_roundTripNestedBoolArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "arrayWithDefault", + "name" : "roundTripNestedBoolArray", "parameters" : [ { - "defaultValue" : { - "array" : { - "_0" : [ - { - "int" : { - "_0" : 1 - } - }, - { - "int" : { - "_0" : 2 - } - }, - { - "int" : { - "_0" : 3 - } - } - ] - } - }, "label" : "_", "name" : "values", "type" : { "array" : { "_0" : { - "int" : { + "array" : { + "_0" : { + "bool" : { + } + } } } } @@ -8862,162 +8913,122 @@ } ], "returnType" : { - "int" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "bool" : { + } + } + } + } } } }, { - "abiName" : "bjs_arrayWithOptionalDefault", + "abiName" : "bjs_roundTripNestedDataPointArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "arrayWithOptionalDefault", + "name" : "roundTripNestedDataPointArray", "parameters" : [ { - "defaultValue" : { - "null" : { - - } - }, "label" : "_", - "name" : "values", + "name" : "points", "type" : { - "nullable" : { + "array" : { "_0" : { "array" : { "_0" : { - "int" : { - + "swiftStruct" : { + "_0" : "DataPoint" } } } - }, - "_1" : "null" + } } } } ], "returnType" : { - "int" : { - + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } } } }, { - "abiName" : "bjs_arrayMixedDefaults", + "abiName" : "bjs_roundTripNestedDirectionArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "arrayMixedDefaults", + "name" : "roundTripNestedDirectionArray", "parameters" : [ { - "defaultValue" : { - "string" : { - "_0" : "Sum" - } - }, - "label" : "prefix", - "name" : "prefix", + "label" : "_", + "name" : "directions", "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { "array" : { - "_0" : [ - { - "int" : { - "_0" : 10 - } - }, - { - "int" : { - "_0" : 20 + "_0" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } } } - ] + } } - }, - "label" : "values", - "name" : "values", - "type" : { + } + } + ], + "returnType" : { + "array" : { + "_0" : { "array" : { "_0" : { - "int" : { - + "caseEnum" : { + "_0" : "Direction" } } } } - }, - { - "defaultValue" : { - "string" : { - "_0" : "!" - } - }, - "label" : "suffix", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - } } }, { - "abiName" : "bjs_formatName", + "abiName" : "bjs_roundTripNestedGreeterArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "formatName", + "name" : "roundTripNestedGreeterArray", "parameters" : [ { "label" : "_", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "label" : "transform", - "name" : "transform", + "name" : "greeters", "type" : { - "closure" : { + "array" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" } } - ], - "returnType" : { - "string" : { - - } } } } @@ -9025,47 +9036,87 @@ } ], "returnType" : { - "string" : { - + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } } } }, { - "abiName" : "bjs_makeFormatter", + "abiName" : "bjs_roundTripUnsafeRawPointerArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeFormatter", + "name" : "roundTripUnsafeRawPointerArray", "parameters" : [ { - "label" : "prefix", - "name" : "prefix", + "label" : "_", + "name" : "values", "type" : { - "string" : { - + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } } } } ], "returnType" : { - "closure" : { + "array" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" } - ], - "returnType" : { - "string" : { - + } + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeMutableRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutableRawPointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" } } } @@ -9073,41 +9124,36 @@ } }, { - "abiName" : "bjs_makeAdder", + "abiName" : "bjs_roundTripOpaquePointerArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeAdder", + "name" : "roundTripOpaquePointerArray", "parameters" : [ { - "label" : "base", - "name" : "base", + "label" : "_", + "name" : "values", "type" : { - "int" : { - + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } } } } ], "returnType" : { - "closure" : { + "array" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - } - ], - "returnType" : { - "int" : { - + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" } } } @@ -9115,13 +9161,13 @@ } }, { - "abiName" : "bjs_roundTripIntArray", + "abiName" : "bjs_roundTripUnsafePointerArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripIntArray", + "name" : "roundTripUnsafePointerArray", "parameters" : [ { "label" : "_", @@ -9129,8 +9175,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } } } } @@ -9140,21 +9189,24 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } } } } } }, { - "abiName" : "bjs_roundTripStringArray", + "abiName" : "bjs_roundTripUnsafeMutablePointerArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripStringArray", + "name" : "roundTripUnsafeMutablePointerArray", "parameters" : [ { "label" : "_", @@ -9162,8 +9214,11 @@ "type" : { "array" : { "_0" : { - "string" : { - + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } } } } @@ -9173,30 +9228,33 @@ "returnType" : { "array" : { "_0" : { - "string" : { - + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } } } } } }, { - "abiName" : "bjs_roundTripDoubleArray", + "abiName" : "bjs_consumeDataProcessorArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripDoubleArray", + "name" : "consumeDataProcessorArrayType", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "processors", "type" : { "array" : { "_0" : { - "double" : { - + "swiftProtocol" : { + "_0" : "DataProcessor" } } } @@ -9204,32 +9262,28 @@ } ], "returnType" : { - "array" : { - "_0" : { - "double" : { + "int" : { - } - } } } }, { - "abiName" : "bjs_roundTripBoolArray", + "abiName" : "bjs_roundTripDataProcessorArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripBoolArray", + "name" : "roundTripDataProcessorArrayType", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "processors", "type" : { "array" : { "_0" : { - "bool" : { - + "swiftProtocol" : { + "_0" : "DataProcessor" } } } @@ -9239,30 +9293,30 @@ "returnType" : { "array" : { "_0" : { - "bool" : { - + "swiftProtocol" : { + "_0" : "DataProcessor" } } } } }, { - "abiName" : "bjs_roundTripDirectionArray", + "abiName" : "bjs_roundTripJSObjectArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripDirectionArray", + "name" : "roundTripJSObjectArray", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "objects", "type" : { "array" : { "_0" : { - "caseEnum" : { - "_0" : "Direction" + "jsObject" : { + } } } @@ -9272,30 +9326,35 @@ "returnType" : { "array" : { "_0" : { - "caseEnum" : { - "_0" : "Direction" + "jsObject" : { + } } } } }, { - "abiName" : "bjs_roundTripStatusArray", + "abiName" : "bjs_roundTripOptionalJSObjectArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripStatusArray", + "name" : "roundTripOptionalJSObjectArray", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "objects", "type" : { "array" : { "_0" : { - "caseEnum" : { - "_0" : "Status" + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" } } } @@ -9305,31 +9364,35 @@ "returnType" : { "array" : { "_0" : { - "caseEnum" : { - "_0" : "Status" + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" } } } } }, { - "abiName" : "bjs_roundTripThemeArray", + "abiName" : "bjs_roundTripFooArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripThemeArray", + "name" : "roundTripFooArray", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "foos", "type" : { "array" : { "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "jsObject" : { + "_0" : "Foo" } } } @@ -9339,32 +9402,35 @@ "returnType" : { "array" : { "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "jsObject" : { + "_0" : "Foo" } } } } }, { - "abiName" : "bjs_roundTripHttpStatusArray", + "abiName" : "bjs_roundTripOptionalFooArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripHttpStatusArray", + "name" : "roundTripOptionalFooArray", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "foos", "type" : { "array" : { "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" } } } @@ -9374,316 +9440,280 @@ "returnType" : { "array" : { "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" } } } } }, { - "abiName" : "bjs_roundTripDataPointArray", + "abiName" : "bjs_roundTripOptionalString", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripDataPointArray", + "name" : "roundTripOptionalString", "parameters" : [ { - "label" : "_", - "name" : "points", + "label" : "name", + "name" : "name", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" + "string" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" + "string" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripGreeterArray", + "abiName" : "bjs_roundTripOptionalInt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripGreeterArray", + "name" : "roundTripOptionalInt", "parameters" : [ { - "label" : "_", - "name" : "greeters", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "int" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "int" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalIntArray", + "abiName" : "bjs_roundTripOptionalBool", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalIntArray", + "name" : "roundTripOptionalBool", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "flag", + "name" : "flag", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "int" : { + "bool" : { - } - }, - "_1" : "null" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "int" : { + "bool" : { - } - }, - "_1" : "null" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalStringArray", + "abiName" : "bjs_roundTripOptionalFloat", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStringArray", + "name" : "roundTripOptionalFloat", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "number", + "name" : "number", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "string" : { + "float" : { - } - }, - "_1" : "null" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "string" : { + "float" : { - } - }, - "_1" : "null" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalDataPointArray", + "abiName" : "bjs_roundTripOptionalDouble", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalDataPointArray", + "name" : "roundTripOptionalDouble", "parameters" : [ { - "label" : "_", - "name" : "points", + "label" : "precision", + "name" : "precision", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - }, - "_1" : "null" + "double" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - }, - "_1" : "null" + "double" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalDirectionArray", + "abiName" : "bjs_roundTripOptionalSyntax", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalDirectionArray", + "name" : "roundTripOptionalSyntax", "parameters" : [ { - "label" : "_", - "name" : "directions", + "label" : "name", + "name" : "name", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" + "string" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" + "string" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalStatusArray", + "abiName" : "bjs_roundTripOptionalMixSyntax", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStatusArray", + "name" : "roundTripOptionalMixSyntax", "parameters" : [ { - "label" : "_", - "name" : "statuses", + "label" : "name", + "name" : "name", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "string" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "string" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalIntArrayType", + "abiName" : "bjs_roundTripOptionalSwiftSyntax", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalIntArrayType", + "name" : "roundTripOptionalSwiftSyntax", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "name", + "name" : "name", "type" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "int" : { + "string" : { - } - } } }, "_1" : "null" @@ -9694,12 +9724,8 @@ "returnType" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "int" : { + "string" : { - } - } } }, "_1" : "null" @@ -9707,26 +9733,22 @@ } }, { - "abiName" : "bjs_roundTripOptionalStringArrayType", + "abiName" : "bjs_roundTripOptionalWithSpaces", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStringArrayType", + "name" : "roundTripOptionalWithSpaces", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "string" : { + "double" : { - } - } } }, "_1" : "null" @@ -9737,12 +9759,8 @@ "returnType" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "string" : { + "double" : { - } - } } }, "_1" : "null" @@ -9750,26 +9768,22 @@ } }, { - "abiName" : "bjs_roundTripOptionalGreeterArrayType", + "abiName" : "bjs_roundTripOptionalTypeAlias", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalGreeterArrayType", + "name" : "roundTripOptionalTypeAlias", "parameters" : [ { - "label" : "_", - "name" : "greeters", + "label" : "age", + "name" : "age", "type" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } + "int" : { + } }, "_1" : "null" @@ -9780,12 +9794,8 @@ "returnType" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } + "int" : { + } }, "_1" : "null" @@ -9793,598 +9803,589 @@ } }, { - "abiName" : "bjs_roundTripNestedIntArray", + "abiName" : "bjs_roundTripOptionalStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedIntArray", + "name" : "roundTripOptionalStatus", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } + "caseEnum" : { + "_0" : "Status" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedStringArray", + "abiName" : "bjs_roundTripOptionalTheme", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedStringArray", + "name" : "roundTripOptionalTheme", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedDoubleArray", + "abiName" : "bjs_roundTripOptionalHttpStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedDoubleArray", + "name" : "roundTripOptionalHttpStatus", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "double" : { - - } - } + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "double" : { - - } - } + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedBoolArray", + "abiName" : "bjs_roundTripOptionalTSDirection", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedBoolArray", + "name" : "roundTripOptionalTSDirection", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "bool" : { - - } - } + "caseEnum" : { + "_0" : "TSDirection" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "bool" : { - - } - } + "caseEnum" : { + "_0" : "TSDirection" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedDataPointArray", + "abiName" : "bjs_roundTripOptionalTSTheme", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedDataPointArray", + "name" : "roundTripOptionalTSTheme", "parameters" : [ { - "label" : "_", - "name" : "points", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedDirectionArray", + "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedDirectionArray", + "name" : "roundTripOptionalNetworkingAPIMethod", "parameters" : [ { "label" : "_", - "name" : "directions", + "name" : "method", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } + "caseEnum" : { + "_0" : "Networking.API.Method" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } + "caseEnum" : { + "_0" : "Networking.API.Method" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedGreeterArray", + "abiName" : "bjs_roundTripOptionalAPIResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedGreeterArray", + "name" : "roundTripOptionalAPIResult", "parameters" : [ { - "label" : "_", - "name" : "greeters", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } + "associatedValueEnum" : { + "_0" : "APIResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } + "associatedValueEnum" : { + "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripUnsafeRawPointerArray", + "abiName" : "bjs_roundTripOptionalTypedPayloadResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeRawPointerArray", + "name" : "roundTripOptionalTypedPayloadResult", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripUnsafeMutableRawPointerArray", + "abiName" : "bjs_compareAPIResults", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeMutableRawPointerArray", + "name" : "compareAPIResults", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "r1", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "r2", "type" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } + "associatedValueEnum" : { + "_0" : "APIResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } + "string" : { + } } }, { - "abiName" : "bjs_roundTripOpaquePointerArray", + "abiName" : "bjs_roundTripOptionalComplexResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOpaquePointerArray", + "name" : "roundTripOptionalComplexResult", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } + "associatedValueEnum" : { + "_0" : "ComplexResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } + "associatedValueEnum" : { + "_0" : "ComplexResult" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripUnsafePointerArray", + "abiName" : "bjs_roundTripOptionalAllTypesResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafePointerArray", + "name" : "roundTripOptionalAllTypesResult", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } + "associatedValueEnum" : { + "_0" : "AllTypesResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } + "associatedValueEnum" : { + "_0" : "AllTypesResult" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripUnsafeMutablePointerArray", + "abiName" : "bjs_roundTripOptionalPayloadResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeMutablePointerArray", + "name" : "roundTripOptionalPayloadResult", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "result", "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" } } } ], "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" } } }, { - "abiName" : "bjs_consumeDataProcessorArrayType", + "abiName" : "bjs_roundTripOptionalPayloadResultOpt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "consumeDataProcessorArrayType", + "name" : "roundTripOptionalPayloadResultOpt", "parameters" : [ { "label" : "_", - "name" : "processors", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "int" : { - + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripDataProcessorArrayType", + "abiName" : "bjs_roundTripOptionalClass", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripDataProcessorArrayType", + "name" : "roundTripOptionalClass", "parameters" : [ { - "label" : "_", - "name" : "processors", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripJSObjectArray", + "abiName" : "bjs_roundTripOptionalGreeter", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripJSObjectArray", + "name" : "roundTripOptionalGreeter", "parameters" : [ { "label" : "_", - "name" : "objects", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "jsObject" : { - + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "jsObject" : { - + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalJSObjectArray", + "abiName" : "bjs_applyOptionalGreeter", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalJSObjectArray", + "name" : "applyOptionalGreeter", "parameters" : [ { "label" : "_", - "name" : "objects", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" } - }, - "_1" : "null" + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } } } } @@ -10392,93 +10393,92 @@ } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripFooArray", + "abiName" : "bjs_makeOptionalHolder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripFooArray", + "name" : "makeOptionalHolder", "parameters" : [ { - "label" : "_", - "name" : "foos", + "label" : "nullableGreeter", + "name" : "nullableGreeter", "type" : { - "array" : { + "nullable" : { "_0" : { - "jsObject" : { - "_0" : "Foo" + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" + } + } + }, + { + "label" : "undefinedNumber", + "name" : "undefinedNumber", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" } } } ], "returnType" : { - "array" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - } + "swiftHeapObject" : { + "_0" : "OptionalHolder" } } }, { - "abiName" : "bjs_roundTripOptionalFooArray", + "abiName" : "bjs_roundTripOptionalAPIOptionalResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalFooArray", + "name" : "roundTripOptionalAPIOptionalResult", "parameters" : [ { - "label" : "_", - "name" : "foos", + "label" : "result", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } }, @@ -12870,62 +12870,6 @@ } } }, - { - "name" : "jsRoundTripOptionalNumberNull", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - }, - { - "name" : "jsRoundTripOptionalNumberUndefined", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - }, { "name" : "jsRoundTripJSValue", "parameters" : [ @@ -14025,6 +13969,136 @@ ], "types" : [ + ] + }, + { + "functions" : [ + { + "name" : "runJsOptionalSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsRoundTripOptionalNumberNull", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "jsRoundTripOptionalNumberUndefined", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "name" : "jsRoundTripOptionalStringNull", + "parameters" : [ + { + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "jsRoundTripOptionalStringUndefined", + "parameters" : [ + { + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "types" : [ + ] } ] diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index a465c57b..cef881db 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -35,26 +35,6 @@ class ImportAPITests: XCTestCase { } } - func testRoundTripOptionalNumberNull() throws { - try XCTAssertEqual(jsRoundTripOptionalNumberNull(42), 42) - try XCTAssertNil(jsRoundTripOptionalNumberNull(nil)) - } - - func testRoundTripOptionalNumberUndefined() throws { - let some = try jsRoundTripOptionalNumberUndefined(.value(42)) - switch some { - case .value(let value): - XCTAssertEqual(value, 42) - case .undefined: - XCTFail("Expected defined value") - } - - let undefined = try jsRoundTripOptionalNumberUndefined(.undefinedValue) - if case .value = undefined { - XCTFail("Expected undefined") - } - } - func testRoundTripJSValue() throws { let symbol = JSSymbol("roundTrip") let bigInt = JSBigInt(_slowBridge: Int64(123456789)) diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs new file mode 100644 index 00000000..8a856582 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs @@ -0,0 +1,219 @@ +// @ts-check + +import assert from 'node:assert'; +import { + StatusValues, + ThemeValues, + HttpStatusValues, + TSDirection, + TSTheme, + APIResultValues, + APIOptionalResultValues, + AllTypesResultValues, + OptionalAllTypesResultValues, +} from '../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.js'; + +import { ImportedFoo } from './Types.mjs'; + +/** + * Optional value bridging coverage for BridgeJS runtime tests. + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + */ +export function runJsOptionalSupportTests(exports) { + assert.equal(exports.roundTripOptionalString(null), null); + assert.equal(exports.roundTripOptionalInt(null), null); + assert.equal(exports.roundTripOptionalBool(null), null); + assert.equal(exports.roundTripOptionalFloat(null), null); + assert.equal(exports.roundTripOptionalDouble(null), null); + + assert.equal(exports.roundTripOptionalString('Hello'), 'Hello'); + assert.equal(exports.roundTripOptionalInt(42), 42); + assert.equal(exports.roundTripOptionalBool(true), true); + assert.equal(exports.roundTripOptionalFloat(3.141592502593994), 3.141592502593994); // Float32 precision + assert.equal(exports.roundTripOptionalDouble(2.718), 2.718); + + assert.equal(exports.roundTripOptionalSyntax(null), null); + assert.equal(exports.roundTripOptionalSyntax('Test'), 'Test'); + assert.equal(exports.roundTripOptionalMixSyntax(null), null); + assert.equal(exports.roundTripOptionalMixSyntax('Mix'), 'Mix'); + assert.equal(exports.roundTripOptionalSwiftSyntax(null), null); + assert.equal(exports.roundTripOptionalSwiftSyntax('Swift'), 'Swift'); + assert.equal(exports.roundTripOptionalWithSpaces(null), null); + assert.equal(exports.roundTripOptionalWithSpaces(1.618), 1.618); + assert.equal(exports.roundTripOptionalTypeAlias(null), null); + assert.equal(exports.roundTripOptionalTypeAlias(25), 25); + assert.equal(exports.roundTripOptionalStatus(exports.Status.Success), StatusValues.Success); + assert.equal(exports.roundTripOptionalTheme(exports.Theme.Light), ThemeValues.Light); + assert.equal(exports.roundTripOptionalHttpStatus(exports.HttpStatus.Ok), HttpStatusValues.Ok); + assert.equal(exports.roundTripOptionalTSDirection(TSDirection.North), TSDirection.North); + assert.equal(exports.roundTripOptionalTSTheme(TSTheme.Light), TSTheme.Light); + assert.equal(exports.roundTripOptionalNetworkingAPIMethod(exports.Networking.API.Method.Get), exports.Networking.API.Method.Get); + + const pVal = 3.141592653589793; + const p1 = { tag: APIResultValues.Tag.Precise, param0: pVal }; + const cl1 = { tag: exports.ComplexResult.Tag.Location, param0: 37.7749, param1: -122.4194, param2: 'San Francisco' }; + + assert.deepEqual(exports.roundTripOptionalAPIResult(p1), p1); + assert.deepEqual(exports.roundTripOptionalComplexResult(cl1), cl1); + + const apiSuccess = { tag: exports.APIResult.Tag.Success, param0: 'test success' }; + const apiFailure = { tag: exports.APIResult.Tag.Failure, param0: 404 }; + const apiInfo = { tag: exports.APIResult.Tag.Info }; + + assert.equal(exports.compareAPIResults(apiSuccess, apiFailure), 'r1:success:test success,r2:failure:404'); + assert.equal(exports.compareAPIResults(null, apiInfo), 'r1:nil,r2:info'); + assert.equal(exports.compareAPIResults(apiFailure, null), 'r1:failure:404,r2:nil'); + assert.equal(exports.compareAPIResults(null, null), 'r1:nil,r2:nil'); + + const optionalGreeter = new exports.Greeter('Schrödinger'); + const optionalGreeter2 = exports.roundTripOptionalClass(optionalGreeter); + assert.equal(optionalGreeter2?.greet() ?? '', 'Hello, Schrödinger!'); + assert.equal(optionalGreeter2?.name ?? '', 'Schrödinger'); + assert.equal(optionalGreeter2?.prefix ?? '', 'Hello'); + assert.equal(exports.roundTripOptionalClass(null), null); + optionalGreeter.release(); + optionalGreeter2?.release(); + + const optionalsHolder = new exports.OptionalPropertyHolder(null); + + assert.equal(optionalsHolder.optionalName, null); + assert.equal(optionalsHolder.optionalAge, null); + assert.equal(optionalsHolder.optionalGreeter, null); + + optionalsHolder.optionalName = 'Alice'; + optionalsHolder.optionalAge = 25; + assert.equal(optionalsHolder.optionalName, 'Alice'); + assert.equal(optionalsHolder.optionalAge, 25); + + const testPropertyGreeter = new exports.Greeter('Bob'); + optionalsHolder.optionalGreeter = testPropertyGreeter; + assert.equal(optionalsHolder.optionalGreeter.greet(), 'Hello, Bob!'); + assert.equal(optionalsHolder.optionalGreeter.name, 'Bob'); + + optionalsHolder.optionalName = null; + optionalsHolder.optionalAge = null; + optionalsHolder.optionalGreeter = null; + assert.equal(optionalsHolder.optionalName, null); + assert.equal(optionalsHolder.optionalAge, null); + assert.equal(optionalsHolder.optionalGreeter, null); + testPropertyGreeter.release(); + optionalsHolder.release(); + + const optGreeter = new exports.Greeter('Optionaly'); + assert.equal(exports.roundTripOptionalGreeter(null), null); + const optGreeterReturned = exports.roundTripOptionalGreeter(optGreeter); + assert.equal(optGreeterReturned.name, 'Optionaly'); + assert.equal(optGreeterReturned.greet(), 'Hello, Optionaly!'); + + const appliedOptional = exports.applyOptionalGreeter(null, (g) => g ?? optGreeter); + assert.equal(appliedOptional.name, 'Optionaly'); + + const holderOpt = exports.makeOptionalHolder(null, undefined); + assert.equal(holderOpt.nullableGreeter, null); + assert.equal(holderOpt.undefinedNumber, undefined); + holderOpt.nullableGreeter = optGreeter; + holderOpt.undefinedNumber = 123.5; + assert.equal(holderOpt.nullableGreeter.name, 'Optionaly'); + assert.equal(holderOpt.undefinedNumber, 123.5); + holderOpt.release(); + optGreeterReturned.release(); + optGreeter.release(); + + const aor1 = { tag: APIOptionalResultValues.Tag.Success, param0: 'hello world' }; + const aor2 = { tag: APIOptionalResultValues.Tag.Success, param0: null }; + const aor3 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: true }; + const aor4 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: null }; + const aor5 = { tag: APIOptionalResultValues.Tag.Failure, param0: null, param1: null }; + const aor6 = { tag: APIOptionalResultValues.Tag.Status, param0: true, param1: 200, param2: 'OK' }; + const aor7 = { tag: APIOptionalResultValues.Tag.Status, param0: true, param1: null, param2: 'Partial' }; + const aor8 = { tag: APIOptionalResultValues.Tag.Status, param0: null, param1: null, param2: 'Zero' }; + const aor9 = { tag: APIOptionalResultValues.Tag.Status, param0: false, param1: 500, param2: null }; + const aor10 = { tag: APIOptionalResultValues.Tag.Status, param0: null, param1: 0, param2: 'Zero' }; + + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor1), aor1); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor2), aor2); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor3), aor3); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor4), aor4); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor5), aor5); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor6), aor6); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor7), aor7); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor8), aor8); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor9), aor9); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor10), aor10); + assert.equal(exports.roundTripOptionalAPIOptionalResult(null), null); + + // Optional TypedPayloadResult roundtrip + const tpr_precision = { tag: exports.TypedPayloadResult.Tag.Precision, param0: Math.fround(0.1) }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_precision), tpr_precision); + const tpr_direction = { tag: exports.TypedPayloadResult.Tag.Direction, param0: exports.Direction.North }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_direction), tpr_direction); + const tpr_optPrecisionSome = { tag: exports.TypedPayloadResult.Tag.OptPrecision, param0: Math.fround(0.001) }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionSome), tpr_optPrecisionSome); + const tpr_optPrecisionNull = { tag: exports.TypedPayloadResult.Tag.OptPrecision, param0: null }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionNull), tpr_optPrecisionNull); + const tpr_empty = { tag: exports.TypedPayloadResult.Tag.Empty }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_empty), tpr_empty); + assert.equal(exports.roundTripOptionalTypedPayloadResult(null), null); + + // Optional AllTypesResult roundtrip + const atr_struct = { tag: AllTypesResultValues.Tag.StructPayload, param0: { street: "100 Main St", city: "Boston", zipCode: 2101 } }; + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_struct), atr_struct); + const atr_array = { tag: AllTypesResultValues.Tag.ArrayPayload, param0: [10, 20, 30] }; + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_array), atr_array); + const atr_empty = { tag: AllTypesResultValues.Tag.Empty }; + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_empty), atr_empty); + assert.equal(exports.roundTripOptionalAllTypesResult(null), null); + + // OptionalAllTypesResult — optional struct, class, JSObject, nested enum, array as associated value payloads + const oatr_structSome = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: { street: "200 Oak St", city: "Denver", zipCode: null } }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structSome), oatr_structSome); + + const oatr_structNone = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structNone), oatr_structNone); + + const oatr_classSome = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: new exports.Greeter("OptEnumUser") }; + const oatr_classSome_result = exports.roundTripOptionalPayloadResult(oatr_classSome); + assert.equal(oatr_classSome_result.tag, OptionalAllTypesResultValues.Tag.OptClass); + assert.equal(oatr_classSome_result.param0.name, "OptEnumUser"); + + const oatr_classNone = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_classNone), oatr_classNone); + + const oatr_jsObjectSome = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: { key: "value" } }; + const oatr_jsObjectSome_result = exports.roundTripOptionalPayloadResult(oatr_jsObjectSome); + assert.equal(oatr_jsObjectSome_result.tag, OptionalAllTypesResultValues.Tag.OptJSObject); + assert.equal(oatr_jsObjectSome_result.param0.key, "value"); + + const oatr_jsObjectNone = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsObjectNone), oatr_jsObjectNone); + + const oatr_nestedEnumSome = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: { tag: APIResultValues.Tag.Failure, param0: 404 } }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumSome), oatr_nestedEnumSome); + + const oatr_nestedEnumNone = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumNone), oatr_nestedEnumNone); + + const oatr_arraySome = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: [1, 2, 3] }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arraySome), oatr_arraySome); + + const oatr_arrayNone = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arrayNone), oatr_arrayNone); + + const oatr_jsClassSome = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: new ImportedFoo("optEnumFoo") }; + const oatr_jsClassSome_result = exports.roundTripOptionalPayloadResult(oatr_jsClassSome); + assert.equal(oatr_jsClassSome_result.tag, OptionalAllTypesResultValues.Tag.OptJsClass); + assert.equal(oatr_jsClassSome_result.param0.value, "optEnumFoo"); + + const oatr_jsClassNone = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsClassNone), oatr_jsClassNone); + + const oatr_empty = { tag: OptionalAllTypesResultValues.Tag.Empty }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_empty), oatr_empty); + + // Optional OptionalAllTypesResult roundtrip + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structSome), oatr_structSome); + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structNone), oatr_structNone); + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_empty), oatr_empty); + assert.equal(exports.roundTripOptionalPayloadResultOpt(null), null); + +} diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/Types.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/Types.mjs new file mode 100644 index 00000000..b4c2079d --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/JavaScript/Types.mjs @@ -0,0 +1,6 @@ +export class ImportedFoo { + /** @param {string} value */ + constructor(value) { + this.value = value; + } +} diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift new file mode 100644 index 00000000..bc0f1fcc --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -0,0 +1,232 @@ +import XCTest +@_spi(Experimental) import JavaScriptKit +import JavaScriptEventLoop + +@JSFunction func runJsOptionalSupportTests() throws + +final class OptionalSupportTests: XCTestCase { + func testRunJsOptionalSupportTests() throws { + try runJsOptionalSupportTests() + } + + // FIXME: Optional return type on imported function is broken + // func testRoundTripOptionalStringNull() throws { + // try XCTAssertEqual(jsRoundTripOptionalStringNull("hello"), "hello") + // try XCTAssertNil(jsRoundTripOptionalStringNull(nil)) + // } + + // func testRoundTripOptionalStringUndefined() throws { + // let some = try jsRoundTripOptionalStringUndefined(.value("hi")) + // switch some { + // case .value(let value): + // XCTAssertEqual(value, "hi") + // case .undefined: + // XCTFail("Expected defined value") + // } + + // let undefined = try jsRoundTripOptionalStringUndefined(.undefinedValue) + // if case .value = undefined { + // XCTFail("Expected undefined") + // } + // } + + func testRoundTripOptionalNumberNull() throws { + try XCTAssertEqual(jsRoundTripOptionalNumberNull(42), 42) + try XCTAssertNil(jsRoundTripOptionalNumberNull(nil)) + } + + func testRoundTripOptionalNumberUndefined() throws { + let some = try jsRoundTripOptionalNumberUndefined(.value(42)) + switch some { + case .value(let value): + XCTAssertEqual(value, 42) + case .undefined: + XCTFail("Expected defined value") + } + + let undefined = try jsRoundTripOptionalNumberUndefined(.undefined) + if case .value = undefined { + XCTFail("Expected undefined") + } + } +} + +// MARK: - Optional Bridging + +@JSFunction func jsRoundTripOptionalNumberNull(_ value: Int?) throws -> Int? +@JSFunction func jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws -> JSUndefinedOr +@JSFunction func jsRoundTripOptionalStringNull(_ name: String?) throws -> String? +@JSFunction func jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws -> JSUndefinedOr + +@JS func roundTripOptionalString(name: String?) -> String? { + name +} + +@JS func roundTripOptionalInt(value: Int?) -> Int? { + value +} + +@JS func roundTripOptionalBool(flag: Bool?) -> Bool? { + flag +} + +@JS func roundTripOptionalFloat(number: Float?) -> Float? { + number +} + +@JS func roundTripOptionalDouble(precision: Double?) -> Double? { + precision +} + +@JS func roundTripOptionalSyntax(name: Optional) -> Optional { + name +} + +@JS func roundTripOptionalMixSyntax(name: String?) -> Optional { + name +} + +@JS func roundTripOptionalSwiftSyntax(name: Swift.Optional) -> Swift.Optional { + name +} + +@JS func roundTripOptionalWithSpaces(value: Optional) -> Optional { + value +} + +typealias OptionalAge = Int? +@JS func roundTripOptionalTypeAlias(age: OptionalAge) -> OptionalAge { + age +} + +@JS func roundTripOptionalStatus(value: Status?) -> Status? { + value +} + +@JS func roundTripOptionalTheme(value: Theme?) -> Theme? { + value +} + +@JS func roundTripOptionalHttpStatus(value: HttpStatus?) -> HttpStatus? { + value +} + +@JS func roundTripOptionalTSDirection(value: TSDirection?) -> TSDirection? { + value +} + +@JS func roundTripOptionalTSTheme(value: TSTheme?) -> TSTheme? { + value +} + +@JS func roundTripOptionalNetworkingAPIMethod(_ method: Networking.API.Method?) -> Networking.API.Method? { + method +} + +@JS func roundTripOptionalAPIResult(value: APIResult?) -> APIResult? { + value +} + +@JS func roundTripOptionalTypedPayloadResult(_ result: TypedPayloadResult?) -> TypedPayloadResult? { + result +} + +@JS func compareAPIResults(_ r1: APIResult?, _ r2: APIResult?) -> String { + let r1Str: String + switch r1 { + case .none: r1Str = "nil" + case .some(.success(let msg)): r1Str = "success:\(msg)" + case .some(.failure(let code)): r1Str = "failure:\(code)" + case .some(.info): r1Str = "info" + case .some(.flag(let b)): r1Str = "flag:\(b)" + case .some(.rate(let r)): r1Str = "rate:\(r)" + case .some(.precise(let p)): r1Str = "precise:\(p)" + } + + let r2Str: String + switch r2 { + case .none: r2Str = "nil" + case .some(.success(let msg)): r2Str = "success:\(msg)" + case .some(.failure(let code)): r2Str = "failure:\(code)" + case .some(.info): r2Str = "info" + case .some(.flag(let b)): r2Str = "flag:\(b)" + case .some(.rate(let r)): r2Str = "rate:\(r)" + case .some(.precise(let p)): r2Str = "precise:\(p)" + } + + return "r1:\(r1Str),r2:\(r2Str)" +} + +@JS func roundTripOptionalComplexResult(_ result: ComplexResult?) -> ComplexResult? { + result +} + +@JS func roundTripOptionalAllTypesResult(_ result: AllTypesResult?) -> AllTypesResult? { + result +} + +@JS +enum OptionalAllTypesResult { + case optStruct(Address?) + case optClass(Greeter?) + case optJSObject(JSObject?) + case optNestedEnum(APIResult?) + case optArray([Int]?) + case optJsClass(Foo?) + case empty +} + +@JS func roundTripOptionalPayloadResult(_ result: OptionalAllTypesResult) -> OptionalAllTypesResult { + result +} + +@JS func roundTripOptionalPayloadResultOpt(_ result: OptionalAllTypesResult?) -> OptionalAllTypesResult? { + result +} + +@JS func roundTripOptionalClass(value: Greeter?) -> Greeter? { + value +} + +@JS func roundTripOptionalGreeter(_ value: Greeter?) -> Greeter? { + value +} + +@JS func applyOptionalGreeter(_ value: Greeter?, _ transform: (Greeter?) -> Greeter?) -> Greeter? { + transform(value) +} + +@JS class OptionalHolder { + @JS var nullableGreeter: Greeter? + @JS var undefinedNumber: JSUndefinedOr + + @JS init(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) { + self.nullableGreeter = nullableGreeter + self.undefinedNumber = undefinedNumber + } +} + +@JS func makeOptionalHolder(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) -> OptionalHolder { + OptionalHolder(nullableGreeter: nullableGreeter, undefinedNumber: undefinedNumber) +} + +@JS class OptionalPropertyHolder { + @JS var optionalName: String? + @JS var optionalAge: Int? = nil + @JS var optionalGreeter: Greeter? = nil + + @JS init(optionalName: String?) { + self.optionalName = optionalName + } +} + +@JS +enum APIOptionalResult { + case success(String?) + case failure(Int?, Bool?) + case status(Bool?, Int?, String?) +} + +@JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult? { + result +} diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index b7dc6c48..08d56adf 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -2,8 +2,6 @@ export function jsRoundTripVoid(): void export function jsRoundTripNumber(v: number): number export function jsRoundTripBool(v: boolean): boolean export function jsRoundTripString(v: string): string -export function jsRoundTripOptionalNumberNull(v: number | null): number | null -export function jsRoundTripOptionalNumberUndefined(v: number | undefined): number | undefined export type JSValue = any export function jsRoundTripJSValue(v: JSValue): JSValue export function jsThrowOrVoid(shouldThrow: boolean): void diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index e8f0b081..70e138e6 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -3,6 +3,8 @@ import { DirectionValues, StatusValues, ThemeValues, HttpStatusValues, TSDirection, TSTheme, APIResultValues, ComplexResultValues, APIOptionalResultValues, StaticCalculatorValues, StaticPropertyEnumValues, PrecisionValues, TypedPayloadResultValues, AllTypesResultValues, OptionalAllTypesResultValues } from '../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.js'; +import { ImportedFoo } from './BridgeJSRuntimeTests/JavaScript/Types.mjs'; +import { runJsOptionalSupportTests } from './BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ export async function setupOptions(options, context) { @@ -68,6 +70,12 @@ export async function setupOptions(options, context) { "jsRoundTripOptionalNumberUndefined": (v) => { return v === undefined ? undefined : v; }, + "jsRoundTripOptionalStringNull": (v) => { + return v ?? null; + }, + "jsRoundTripOptionalStringUndefined": (v) => { + return v === undefined ? undefined : v; + }, "jsRoundTripJSValue": (v) => { return v; }, @@ -184,6 +192,11 @@ export async function setupOptions(options, context) { }, roundTripArrayMembers: (value) => { return value; + }, + runJsOptionalSupportTests: () => { + const exports = importsContext.getExports(); + if (!exports) { throw new Error("No exports!?"); } + runJsOptionalSupportTests(exports); } }; }, @@ -220,13 +233,6 @@ export async function setupOptions(options, context) { import assert from "node:assert"; -class ImportedFoo { - /** @param {string} value */ - constructor(value) { - this.value = value; - } -} - /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { exports.roundTripVoid(); @@ -714,123 +720,6 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.deepEqual(exports.makeAPINetworkingResultSuccess("Connected"), { tag: exports.API.NetworkingResult.Tag.Success, param0: "Connected" }); assert.deepEqual(exports.makeAPINetworkingResultFailure("Timeout", 408), { tag: exports.API.NetworkingResult.Tag.Failure, param0: "Timeout", param1: 408 }); - assert.equal(exports.roundTripOptionalString(null), null); - assert.equal(exports.roundTripOptionalInt(null), null); - assert.equal(exports.roundTripOptionalBool(null), null); - assert.equal(exports.roundTripOptionalFloat(null), null); - assert.equal(exports.roundTripOptionalDouble(null), null); - - assert.equal(exports.roundTripOptionalString("Hello"), "Hello"); - assert.equal(exports.roundTripOptionalInt(42), 42); - assert.equal(exports.roundTripOptionalBool(true), true); - assert.equal(exports.roundTripOptionalFloat(3.141592502593994), 3.141592502593994); // Float32 precision - assert.equal(exports.roundTripOptionalDouble(2.718), 2.718); - - assert.equal(exports.roundTripOptionalSyntax(null), null); - assert.equal(exports.roundTripOptionalSyntax("Test"), "Test"); - assert.equal(exports.roundTripOptionalMixSyntax(null), null); - assert.equal(exports.roundTripOptionalMixSyntax("Mix"), "Mix"); - assert.equal(exports.roundTripOptionalSwiftSyntax(null), null); - assert.equal(exports.roundTripOptionalSwiftSyntax("Swift"), "Swift"); - assert.equal(exports.roundTripOptionalWithSpaces(null), null); - assert.equal(exports.roundTripOptionalWithSpaces(1.618), 1.618); - assert.equal(exports.roundTripOptionalTypeAlias(null), null); - assert.equal(exports.roundTripOptionalTypeAlias(25), 25); - assert.equal(exports.roundTripOptionalStatus(exports.Status.Success), StatusValues.Success); - assert.equal(exports.roundTripOptionalTheme(exports.Theme.Light), ThemeValues.Light); - assert.equal(exports.roundTripOptionalHttpStatus(exports.HttpStatus.Ok), HttpStatusValues.Ok); - assert.equal(exports.roundTripOptionalTSDirection(TSDirection.North), TSDirection.North); - assert.equal(exports.roundTripOptionalTSTheme(TSTheme.Light), TSTheme.Light); - assert.equal(exports.roundTripOptionalNetworkingAPIMethod(exports.Networking.API.Method.Get), exports.Networking.API.Method.Get); - assert.deepEqual(exports.roundTripOptionalAPIResult(p1), p1); - assert.deepEqual(exports.roundTripOptionalComplexResult(cl1), cl1); - - const apiSuccess = { tag: exports.APIResult.Tag.Success, param0: "test success" }; - const apiFailure = { tag: exports.APIResult.Tag.Failure, param0: 404 }; - const apiInfo = { tag: exports.APIResult.Tag.Info }; - - assert.equal(exports.compareAPIResults(apiSuccess, apiFailure), "r1:success:test success,r2:failure:404"); - assert.equal(exports.compareAPIResults(null, apiInfo), "r1:nil,r2:info"); - assert.equal(exports.compareAPIResults(apiFailure, null), "r1:failure:404,r2:nil"); - assert.equal(exports.compareAPIResults(null, null), "r1:nil,r2:nil"); - - const optionalGreeter = new exports.Greeter("Schrödinger"); - const optionalGreeter2 = exports.roundTripOptionalClass(optionalGreeter); - assert.equal(optionalGreeter2?.greet() ?? "", "Hello, Schrödinger!"); - assert.equal(optionalGreeter2?.name ?? "", "Schrödinger"); - assert.equal(optionalGreeter2?.prefix ?? "", "Hello"); - assert.equal(exports.roundTripOptionalClass(null), null); - optionalGreeter.release(); - optionalGreeter2?.release(); - - const optionalsHolder = new exports.OptionalPropertyHolder(null); - - assert.equal(optionalsHolder.optionalName, null); - assert.equal(optionalsHolder.optionalAge, null); - assert.equal(optionalsHolder.optionalGreeter, null); - - optionalsHolder.optionalName = "Alice"; - optionalsHolder.optionalAge = 25; - assert.equal(optionalsHolder.optionalName, "Alice"); - assert.equal(optionalsHolder.optionalAge, 25); - - const testPropertyGreeter = new exports.Greeter("Bob"); - optionalsHolder.optionalGreeter = testPropertyGreeter; - assert.equal(optionalsHolder.optionalGreeter.greet(), "Hello, Bob!"); - assert.equal(optionalsHolder.optionalGreeter.name, "Bob"); - - optionalsHolder.optionalName = null; - optionalsHolder.optionalAge = null; - optionalsHolder.optionalGreeter = null; - assert.equal(optionalsHolder.optionalName, null); - assert.equal(optionalsHolder.optionalAge, null); - assert.equal(optionalsHolder.optionalGreeter, null); - testPropertyGreeter.release(); - optionalsHolder.release(); - - const optGreeter = new exports.Greeter("Optionaly"); - assert.equal(exports.roundTripOptionalGreeter(null), null); - const optGreeterReturned = exports.roundTripOptionalGreeter(optGreeter); - assert.equal(optGreeterReturned.name, "Optionaly"); - assert.equal(optGreeterReturned.greet(), "Hello, Optionaly!"); - - const appliedOptional = exports.applyOptionalGreeter(null, (g) => g ?? optGreeter); - assert.equal(appliedOptional.name, "Optionaly"); - - const holderOpt = exports.makeOptionalHolder(null, undefined); - assert.equal(holderOpt.nullableGreeter, null); - assert.equal(holderOpt.undefinedNumber, undefined); - holderOpt.nullableGreeter = optGreeter; - holderOpt.undefinedNumber = 123.5; - assert.equal(holderOpt.nullableGreeter.name, "Optionaly"); - assert.equal(holderOpt.undefinedNumber, 123.5); - holderOpt.release(); - optGreeterReturned.release(); - optGreeter.release(); - - const aor1 = { tag: APIOptionalResultValues.Tag.Success, param0: "hello world" }; - const aor2 = { tag: APIOptionalResultValues.Tag.Success, param0: null }; - const aor3 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: true }; - const aor4 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: null }; - const aor5 = { tag: APIOptionalResultValues.Tag.Failure, param0: null, param1: null }; - const aor6 = { tag: APIOptionalResultValues.Tag.Status, param0: true, param1: 200, param2: "OK" }; - const aor7 = { tag: APIOptionalResultValues.Tag.Status, param0: true, param1: null, param2: "Partial" }; - const aor8 = { tag: APIOptionalResultValues.Tag.Status, param0: null, param1: null, param2: "Zero" }; - const aor9 = { tag: APIOptionalResultValues.Tag.Status, param0: false, param1: 500, param2: null }; - const aor10 = { tag: APIOptionalResultValues.Tag.Status, param0: null, param1: 0, param2: "Zero" }; - - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor1), aor1); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor2), aor2); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor3), aor3); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor4), aor4); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor5), aor5); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor6), aor6); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor7), aor7); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor8), aor8); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor9), aor9); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor10), aor10); - assert.equal(exports.roundTripOptionalAPIOptionalResult(null), null); - // TypedPayloadResult — rawValueEnum and caseEnum as associated value payloads assert.equal(exports.Precision.Rough, 0.1); assert.equal(exports.Precision.Fine, 0.001); @@ -859,14 +748,6 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { const tpr_empty = { tag: exports.TypedPayloadResult.Tag.Empty }; assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_empty), tpr_empty); - // Optional TypedPayloadResult roundtrip - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_precision), tpr_precision); - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_direction), tpr_direction); - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionSome), tpr_optPrecisionSome); - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionNull), tpr_optPrecisionNull); - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_empty), tpr_empty); - assert.equal(exports.roundTripOptionalTypedPayloadResult(null), null); - // AllTypesResult — struct, class, JSObject, nested enum, array as associated value payloads const atr_struct = { tag: AllTypesResultValues.Tag.StructPayload, param0: { street: "100 Main St", city: "Boston", zipCode: 2101 } }; assert.deepEqual(exports.roundTripAllTypesResult(atr_struct), atr_struct); @@ -896,64 +777,6 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { const atr_empty = { tag: AllTypesResultValues.Tag.Empty }; assert.deepEqual(exports.roundTripAllTypesResult(atr_empty), atr_empty); - // Optional AllTypesResult roundtrip - assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_struct), atr_struct); - assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_array), atr_array); - assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_empty), atr_empty); - assert.equal(exports.roundTripOptionalAllTypesResult(null), null); - - // OptionalAllTypesResult — optional struct, class, JSObject, nested enum, array as associated value payloads - const oatr_structSome = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: { street: "200 Oak St", city: "Denver", zipCode: null } }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structSome), oatr_structSome); - - const oatr_structNone = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structNone), oatr_structNone); - - const oatr_classSome = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: new exports.Greeter("OptEnumUser") }; - const oatr_classSome_result = exports.roundTripOptionalPayloadResult(oatr_classSome); - assert.equal(oatr_classSome_result.tag, OptionalAllTypesResultValues.Tag.OptClass); - assert.equal(oatr_classSome_result.param0.name, "OptEnumUser"); - - const oatr_classNone = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_classNone), oatr_classNone); - - const oatr_jsObjectSome = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: { key: "value" } }; - const oatr_jsObjectSome_result = exports.roundTripOptionalPayloadResult(oatr_jsObjectSome); - assert.equal(oatr_jsObjectSome_result.tag, OptionalAllTypesResultValues.Tag.OptJSObject); - assert.equal(oatr_jsObjectSome_result.param0.key, "value"); - - const oatr_jsObjectNone = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsObjectNone), oatr_jsObjectNone); - - const oatr_nestedEnumSome = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: { tag: APIResultValues.Tag.Failure, param0: 404 } }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumSome), oatr_nestedEnumSome); - - const oatr_nestedEnumNone = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumNone), oatr_nestedEnumNone); - - const oatr_arraySome = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: [1, 2, 3] }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arraySome), oatr_arraySome); - - const oatr_arrayNone = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arrayNone), oatr_arrayNone); - - const oatr_jsClassSome = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: new ImportedFoo("optEnumFoo") }; - const oatr_jsClassSome_result = exports.roundTripOptionalPayloadResult(oatr_jsClassSome); - assert.equal(oatr_jsClassSome_result.tag, OptionalAllTypesResultValues.Tag.OptJsClass); - assert.equal(oatr_jsClassSome_result.param0.value, "optEnumFoo"); - - const oatr_jsClassNone = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsClassNone), oatr_jsClassNone); - - const oatr_empty = { tag: OptionalAllTypesResultValues.Tag.Empty }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_empty), oatr_empty); - - // Optional OptionalAllTypesResult roundtrip - assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structSome), oatr_structSome); - assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structNone), oatr_structNone); - assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_empty), oatr_empty); - assert.equal(exports.roundTripOptionalPayloadResultOpt(null), null); - assert.equal(exports.MathUtils.add(2147483647, 0), 2147483647); assert.equal(exports.StaticCalculator.roundtrip(42), 42); assert.equal(StaticCalculatorValues.Scientific, 0);