diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index cfc1b47b..764544ab 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1174,21 +1174,6 @@ enum GraphOperations { } } -// MARK: - Array Tests - -// Optional arrays -@JS func roundTripOptionalIntArrayType(_ values: [Int]?) -> [Int]? { - return values -} - -@JS func roundTripOptionalStringArrayType(_ values: [String]?) -> [String]? { - return values -} - -@JS func roundTripOptionalGreeterArrayType(_ greeters: [Greeter]?) -> [Greeter]? { - return greeters -} - class ExportAPITests: XCTestCase { func testAll() { var hasDeinitGreeter = false diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 34637a32..2b9b0279 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -3652,6 +3652,304 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se #endif } +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalString") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalString") +public func _bjs_OptionalSupportExports_static_roundTripOptionalString(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalString(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalInt") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalInt") +public func _bjs_OptionalSupportExports_static_roundTripOptionalInt(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalInt(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalBool") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalBool") +public func _bjs_OptionalSupportExports_static_roundTripOptionalBool(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalBool(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalFloat") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalFloat") +public func _bjs_OptionalSupportExports_static_roundTripOptionalFloat(_ vIsSome: Int32, _ vValue: Float32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalFloat(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalDouble") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalDouble") +public func _bjs_OptionalSupportExports_static_roundTripOptionalDouble(_ vIsSome: Int32, _ vValue: Float64) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalDouble(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSyntax") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSyntax") +public func _bjs_OptionalSupportExports_static_roundTripOptionalSyntax(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalSyntax(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalCaseEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalStringRawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalIntRawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTSEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTSEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalTSEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalTSEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalTSStringEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalNamespacedEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass") +public func _bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass(_ vIsSome: Int32, _ vValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalSwiftClass(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalIntArray") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalIntArray") +public func _bjs_OptionalSupportExports_static_roundTripOptionalIntArray() -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalIntArray(_: Optional<[Int]>.bridgeJSLiftParameter()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalStringArray") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalStringArray") +public func _bjs_OptionalSupportExports_static_roundTripOptionalStringArray() -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalStringArray(_: Optional<[String]>.bridgeJSLiftParameter()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray") +public func _bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray() -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalSwiftClassArray(_: Optional<[Greeter]>.bridgeJSLiftParameter()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAPIResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAPIResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalAPIResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalAPIResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalComplexResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalComplexResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalComplexResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult(_ v: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt") +public func _bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalAPIOptionalResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_takeOptionalJSObject") +@_cdecl("bjs_OptionalSupportExports_static_takeOptionalJSObject") +public func _bjs_OptionalSupportExports_static_takeOptionalJSObject(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + OptionalSupportExports.takeOptionalJSObject(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_applyOptionalGreeter") +@_cdecl("bjs_OptionalSupportExports_static_applyOptionalGreeter") +public func _bjs_OptionalSupportExports_static_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_makeOptionalHolder") +@_cdecl("bjs_OptionalSupportExports_static_makeOptionalHolder") +public func _bjs_OptionalSupportExports_static_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = OptionalSupportExports.makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_compareAPIResults") +@_cdecl("bjs_OptionalSupportExports_static_compareAPIResults") +public func _bjs_OptionalSupportExports_static_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { + #if arch(wasm32) + let _tmp_r2 = Optional.bridgeJSLiftParameter(r2IsSome, r2CaseId) + let _tmp_r1 = Optional.bridgeJSLiftParameter(r1IsSome, r1CaseId) + let ret = OptionalSupportExports.compareAPIResults(_: _tmp_r1, _: _tmp_r2) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> OptionalAllTypesResult { switch caseId { @@ -6071,359 +6369,6 @@ public func _bjs_makeAdder(_ base: Int32) -> Int32 { #endif } -@_expose(wasm, "bjs_roundTripOptionalIntArrayType") -@_cdecl("bjs_roundTripOptionalIntArrayType") -public func _bjs_roundTripOptionalIntArrayType() -> Void { - #if arch(wasm32) - let ret = roundTripOptionalIntArrayType(_: Optional<[Int]>.bridgeJSLiftParameter()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalStringArrayType") -@_cdecl("bjs_roundTripOptionalStringArrayType") -public func _bjs_roundTripOptionalStringArrayType() -> Void { - #if arch(wasm32) - let ret = roundTripOptionalStringArrayType(_: Optional<[String]>.bridgeJSLiftParameter()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalGreeterArrayType") -@_cdecl("bjs_roundTripOptionalGreeterArrayType") -public func _bjs_roundTripOptionalGreeterArrayType() -> Void { - #if arch(wasm32) - let ret = roundTripOptionalGreeterArrayType(_: Optional<[Greeter]>.bridgeJSLiftParameter()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #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 { - #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_roundTripOptionalWithSpaces") -@_cdecl("bjs_roundTripOptionalWithSpaces") -public func _bjs_roundTripOptionalWithSpaces(_ valueIsSome: Int32, _ valueValue: Float64) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalWithSpaces(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - 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 { - #if arch(wasm32) - let ret = roundTripOptionalTypeAlias(age: Optional.bridgeJSLiftParameter(ageIsSome, ageValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalStatus") -@_cdecl("bjs_roundTripOptionalStatus") -public func _bjs_roundTripOptionalStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - 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 { - #if arch(wasm32) - let ret = roundTripOptionalTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) - 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 { - #if arch(wasm32) - let ret = roundTripOptionalHttpStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - 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 { - #if arch(wasm32) - let ret = roundTripOptionalTSDirection(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - 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 { - #if arch(wasm32) - let ret = roundTripOptionalTSTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) - 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 { - #if arch(wasm32) - let ret = roundTripOptionalNetworkingAPIMethod(_: Optional.bridgeJSLiftParameter(methodIsSome, methodValue)) - 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 { - #if arch(wasm32) - let ret = roundTripOptionalAPIResult(value: Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalTypedPayloadResult") -@_cdecl("bjs_roundTripOptionalTypedPayloadResult") -public func _bjs_roundTripOptionalTypedPayloadResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_takeOptionalJSObject") -@_cdecl("bjs_takeOptionalJSObject") -public func _bjs_takeOptionalJSObject(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - takeOptionalJSObject(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_compareAPIResults") -@_cdecl("bjs_compareAPIResults") -public func _bjs_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { - #if arch(wasm32) - let _tmp_r2 = Optional.bridgeJSLiftParameter(r2IsSome, r2CaseId) - let _tmp_r1 = Optional.bridgeJSLiftParameter(r1IsSome, r1CaseId) - let ret = compareAPIResults(_: _tmp_r1, _: _tmp_r2) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalComplexResult") -@_cdecl("bjs_roundTripOptionalComplexResult") -public func _bjs_roundTripOptionalComplexResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalAllTypesResult") -@_cdecl("bjs_roundTripOptionalAllTypesResult") -public func _bjs_roundTripOptionalAllTypesResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalPayloadResult") -@_cdecl("bjs_roundTripOptionalPayloadResult") -public func _bjs_roundTripOptionalPayloadResult(_ result: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(result)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalPayloadResultOpt") -@_cdecl("bjs_roundTripOptionalPayloadResultOpt") -public func _bjs_roundTripOptionalPayloadResultOpt(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalClass") -@_cdecl("bjs_roundTripOptionalClass") -public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalClass(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalGreeter") -@_cdecl("bjs_roundTripOptionalGreeter") -public func _bjs_roundTripOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_applyOptionalGreeter") -@_cdecl("bjs_applyOptionalGreeter") -public func _bjs_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { - #if arch(wasm32) - let ret = applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeOptionalHolder") -@_cdecl("bjs_makeOptionalHolder") -public func _bjs_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { - #if arch(wasm32) - 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_roundTripOptionalAPIOptionalResult") -@_cdecl("bjs_roundTripOptionalAPIOptionalResult") -public func _bjs_roundTripOptionalAPIOptionalResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalAPIOptionalResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - @_expose(wasm, "bjs_roundTripPointerFields") @_cdecl("bjs_roundTripPointerFields") public func _bjs_roundTripPointerFields() -> Void { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 74ecd9d5..1d55eb47 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -8011,14 +8011,31 @@ }, { "cases" : [ + + ], + "emitStyle" : "const", + "name" : "OptionalSupportExports", + "staticMethods" : [ { - "associatedValues" : [ + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalString", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalString", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "Address" + "string" : { + } }, "_1" : "null" @@ -8026,16 +8043,42 @@ } } ], - "name" : "optStruct" + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } }, { - "associatedValues" : [ + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalInt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalInt", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "int" : { + } }, "_1" : "null" @@ -8043,15 +8086,41 @@ } } ], - "name" : "optClass" + "returnType" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } }, { - "associatedValues" : [ + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalBool", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalBool", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "jsObject" : { + "bool" : { } }, @@ -8060,16 +8129,42 @@ } } ], - "name" : "optJSObject" + "returnType" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } }, { - "associatedValues" : [ + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalFloat", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalFloat", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "float" : { + } }, "_1" : "null" @@ -8077,20 +8172,42 @@ } } ], - "name" : "optNestedEnum" + "returnType" : { + "nullable" : { + "_0" : { + "float" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } }, { - "associatedValues" : [ + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalDouble", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalDouble", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "int" : { + "double" : { - } - } } }, "_1" : "null" @@ -8098,16 +8215,42 @@ } } ], - "name" : "optArray" + "returnType" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } }, { - "associatedValues" : [ + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalSyntax", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "jsObject" : { - "_0" : "Foo" + "string" : { + } }, "_1" : "null" @@ -8115,36 +8258,42 @@ } } ], - "name" : "optJsClass" + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } }, { - "associatedValues" : [ - + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalCaseEnum", + "namespace" : [ + "OptionalSupportExports" ], - "name" : "empty" - } - ], - "emitStyle" : "const", - "name" : "OptionalAllTypesResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "OptionalAllTypesResult", - "tsFullPath" : "OptionalAllTypesResult" - }, - { - "cases" : [ - { - "associatedValues" : [ + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "string" : { - + "caseEnum" : { + "_0" : "Status" } }, "_1" : "null" @@ -8152,69 +8301,220 @@ } } ], - "name" : "success" + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } }, { - "associatedValues" : [ + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalStringRawValueEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "int" : { - + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } }, "_1" : "null" } } - }, - { - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalIntRawValueEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, "_1" : "null" } } } ], - "name" : "failure" + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } }, { - "associatedValues" : [ + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTSEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalTSEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "bool" : { - + "caseEnum" : { + "_0" : "TSDirection" } }, "_1" : "null" } } - }, + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalTSStringEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "int" : { - + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" } }, "_1" : "null" } } - }, + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalNamespacedEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ { + "label" : "_", + "name" : "v", "type" : { "nullable" : { "_0" : { - "string" : { - + "caseEnum" : { + "_0" : "Networking.API.Method" } }, "_1" : "null" @@ -8222,1697 +8522,1711 @@ } } ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "APIOptionalResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIOptionalResult", - "tsFullPath" : "APIOptionalResult" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_roundTripVoid", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_roundTripInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripInt", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "int" : { - + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_roundTripUInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUInt", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "uint" : { - + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalSwiftClass", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } - } - ], - "returnType" : { - "uint" : { - - } - } - }, - { - "abiName" : "bjs_roundTripFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripFloat", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "float" : { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalIntArray", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + } + } + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDouble", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "double" : { + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + } + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_roundTripBool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripBool", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "bool" : { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalStringArray", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + } + } + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_roundTripString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripString", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "string" : { + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + } + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_roundTripSwiftHeapObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripSwiftHeapObject", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalSwiftClassArray", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } - } - ], - "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" + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } } } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - }, - { - "abiName" : "bjs_roundTripUnsafeMutableRawPointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUnsafeMutableRawPointer", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalTypedPayloadResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { "_0" : { - "kind" : "unsafeMutableRawPointer" + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalComplexResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalComplexResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + }, + "_1" : "null" + } } } - } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - }, - { - "abiName" : "bjs_roundTripOpaquePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOpaquePointer", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { + ], + "returnType" : { + "nullable" : { "_0" : { - "kind" : "opaquePointer" - } + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - }, - { - "abiName" : "bjs_roundTripUnsafePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUnsafePointer", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalAllTypesResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + }, + "_1" : "null" + } } } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - }, - { - "abiName" : "bjs_roundTripUnsafeMutablePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUnsafeMutablePointer", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalPayloadResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } } } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - }, - { - "abiName" : "bjs_roundTripJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripJSObject", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "jsObject" : { - + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalPayloadResultOpt", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDictionaryExport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDictionaryExport", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "dictionary" : { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIOptionalResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { "_0" : { - "int" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_takeOptionalJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "takeOptionalJSObject", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + } + }, + "_1" : "null" } } } - } - } - ], - "returnType" : { - "dictionary" : { - "_0" : { - "int" : { + ], + "returnType" : { + "void" : { } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalDictionaryExport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalDictionaryExport", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "dictionary" : { + "abiName" : "bjs_OptionalSupportExports_static_applyOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "applyOptionalGreeter", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "nullable" : { "_0" : { - "string" : { - + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" } }, "_1" : "null" } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "dictionary" : { - "_0" : { - "string" : { + }, + { + "abiName" : "bjs_OptionalSupportExports_static_makeOptionalHolder", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeOptionalHolder", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "nullableGreeter", + "name" : "nullableGreeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "undefinedNumber", + "name" : "undefinedNumber", + "type" : { + "nullable" : { + "_0" : { + "double" : { + } + }, + "_1" : "undefined" } } } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "OptionalHolder" + } }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripJSValue", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "jsValue" : { - + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } - } - ], - "returnType" : { - "jsValue" : { - - } - } - }, - { - "abiName" : "bjs_roundTripOptionalJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalJSValue", - "parameters" : [ + }, { - "label" : "v", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "jsValue" : { - + "abiName" : "bjs_OptionalSupportExports_static_compareAPIResults", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "compareAPIResults", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "r1", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" } - }, - "_1" : "null" + } + }, + { + "label" : "_", + "name" : "r2", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" } } } ], - "returnType" : { - "nullable" : { - "_0" : { - "jsValue" : { + "staticProperties" : [ - } - }, - "_1" : "null" - } - } + ], + "swiftCallName" : "OptionalSupportExports", + "tsFullPath" : "OptionalSupportExports" }, { - "abiName" : "bjs_roundTripOptionalJSValueArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalJSValueArray", - "parameters" : [ + "cases" : [ { - "label" : "v", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "array" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { "_0" : { - "jsValue" : { - + "swiftStruct" : { + "_0" : "Address" } - } + }, + "_1" : "null" } - }, - "_1" : "null" + } } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "jsValue" : { - + ], + "name" : "optStruct" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" } } } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_makeImportedFoo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "makeImportedFoo", - "parameters" : [ + ], + "name" : "optClass" + }, { - "label" : "value", - "name" : "value", - "type" : { - "string" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "jsObject" : { - "_0" : "Foo" - } - } - }, - { - "abiName" : "bjs_throwsSwiftError", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsSwiftError", - "parameters" : [ + ], + "name" : "optJSObject" + }, { - "label" : "shouldThrow", - "name" : "shouldThrow", - "type" : { - "bool" : { - + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithIntResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithIntResult", - "parameters" : [ - - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithStringResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithStringResult", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithBoolResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithBoolResult", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithFloatResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithFloatResult", - "parameters" : [ - - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithDoubleResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithDoubleResult", - "parameters" : [ + ], + "name" : "optNestedEnum" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "int" : { - ], - "returnType" : { - "double" : { + } + } + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optArray" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optJsClass" + }, + { + "associatedValues" : [ + ], + "name" : "empty" } - } - }, - { - "abiName" : "bjs_throwsWithSwiftHeapObjectResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithSwiftHeapObjectResult", - "parameters" : [ - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_throwsWithJSObjectResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithJSObjectResult", - "parameters" : [ + "emitStyle" : "const", + "name" : "OptionalAllTypesResult", + "staticMethods" : [ ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripVoid", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripVoid", - "parameters" : [ + "staticProperties" : [ ], - "returnType" : { - "void" : { - - } - } + "swiftCallName" : "OptionalAllTypesResult", + "tsFullPath" : "OptionalAllTypesResult" }, { - "abiName" : "bjs_asyncRoundTripInt", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripInt", - "parameters" : [ + "cases" : [ { - "label" : "v", - "name" : "v", - "type" : { - "int" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripFloat", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripFloat", - "parameters" : [ + ], + "name" : "success" + }, { - "label" : "v", - "name" : "v", - "type" : { - "float" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "int" : { - } - } - } - ], - "returnType" : { - "float" : { + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "bool" : { - } - } - }, - { - "abiName" : "bjs_asyncRoundTripDouble", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripDouble", - "parameters" : [ + } + }, + "_1" : "null" + } + } + } + ], + "name" : "failure" + }, { - "label" : "v", - "name" : "v", - "type" : { - "double" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "bool" : { - } - } - } - ], - "returnType" : { - "double" : { + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "int" : { - } - } - }, - { - "abiName" : "bjs_asyncRoundTripBool", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripBool", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "bool" : { + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "null" + } + } } - } + ], + "name" : "status" } ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripString", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripString", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "string" : { + "emitStyle" : "const", + "name" : "APIOptionalResult", + "staticMethods" : [ - } - } - } ], - "returnType" : { - "string" : { + "staticProperties" : [ - } - } - }, + ], + "swiftCallName" : "APIOptionalResult", + "tsFullPath" : "APIOptionalResult" + } + ], + "exposeToGlobal" : false, + "functions" : [ { - "abiName" : "bjs_asyncRoundTripSwiftHeapObject", + "abiName" : "bjs_roundTripVoid", "effects" : { - "isAsync" : true, + "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "asyncRoundTripSwiftHeapObject", + "name" : "roundTripVoid", "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } + ], "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "void" : { + } } }, { - "abiName" : "bjs_asyncRoundTripJSObject", + "abiName" : "bjs_roundTripInt", "effects" : { - "isAsync" : true, + "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "asyncRoundTripJSObject", + "name" : "roundTripInt", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "jsObject" : { + "int" : { } } } ], "returnType" : { - "jsObject" : { + "int" : { } } }, { - "abiName" : "bjs_takeGreeter", + "abiName" : "bjs_roundTripUInt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "takeGreeter", + "name" : "roundTripUInt", "parameters" : [ { - "label" : "g", - "name" : "g", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "label" : "name", - "name" : "name", + "label" : "v", + "name" : "v", "type" : { - "string" : { + "uint" : { } } } ], "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_createCalculator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createCalculator", - "parameters" : [ + "uint" : { - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Calculator" } } }, { - "abiName" : "bjs_useCalculator", + "abiName" : "bjs_roundTripFloat", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "useCalculator", + "name" : "roundTripFloat", "parameters" : [ { - "label" : "calc", - "name" : "calc", - "type" : { - "swiftHeapObject" : { - "_0" : "Calculator" - } - } - }, - { - "label" : "x", - "name" : "x", - "type" : { - "int" : { - - } - } - }, - { - "label" : "y", - "name" : "y", + "label" : "v", + "name" : "v", "type" : { - "int" : { + "float" : { } } } ], "returnType" : { - "int" : { + "float" : { } } }, { - "abiName" : "bjs_testGreeterToJSValue", + "abiName" : "bjs_roundTripDouble", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testGreeterToJSValue", + "name" : "roundTripDouble", "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "double" : { - ], - "returnType" : { - "jsObject" : { - + } + } } - } - }, - { - "abiName" : "bjs_testCalculatorToJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testCalculatorToJSValue", - "parameters" : [ - ], "returnType" : { - "jsObject" : { + "double" : { } } }, { - "abiName" : "bjs_testSwiftClassAsJSValue", + "abiName" : "bjs_roundTripBool", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testSwiftClassAsJSValue", + "name" : "roundTripBool", "parameters" : [ { - "label" : "greeter", - "name" : "greeter", + "label" : "v", + "name" : "v", "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "bool" : { + } } } ], "returnType" : { - "jsObject" : { + "bool" : { } } }, { - "abiName" : "bjs_setDirection", + "abiName" : "bjs_roundTripString", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "setDirection", + "name" : "roundTripString", "parameters" : [ { - "label" : "_", - "name" : "direction", + "label" : "v", + "name" : "v", "type" : { - "caseEnum" : { - "_0" : "Direction" + "string" : { + } } } ], "returnType" : { - "caseEnum" : { - "_0" : "Direction" - } - } - }, - { - "abiName" : "bjs_getDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getDirection", - "parameters" : [ + "string" : { - ], - "returnType" : { - "caseEnum" : { - "_0" : "Direction" } } }, { - "abiName" : "bjs_processDirection", + "abiName" : "bjs_roundTripSwiftHeapObject", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "processDirection", + "name" : "roundTripSwiftHeapObject", "parameters" : [ { - "label" : "_", - "name" : "input", + "label" : "v", + "name" : "v", "type" : { - "caseEnum" : { - "_0" : "Direction" + "swiftHeapObject" : { + "_0" : "Greeter" } } } ], "returnType" : { - "caseEnum" : { - "_0" : "Status" + "swiftHeapObject" : { + "_0" : "Greeter" } } }, { - "abiName" : "bjs_setTheme", + "abiName" : "bjs_roundTripUnsafeRawPointer", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "setTheme", + "name" : "roundTripUnsafeRawPointer", "parameters" : [ { - "label" : "_", - "name" : "theme", + "label" : "v", + "name" : "v", "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } } } } ], "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_getTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTheme", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } } } }, { - "abiName" : "bjs_setHttpStatus", + "abiName" : "bjs_roundTripUnsafeMutableRawPointer", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "setHttpStatus", + "name" : "roundTripUnsafeMutableRawPointer", "parameters" : [ { - "label" : "_", - "name" : "status", + "label" : "v", + "name" : "v", "type" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } } } } ], "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } } } }, { - "abiName" : "bjs_getHttpStatus", + "abiName" : "bjs_roundTripOpaquePointer", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getHttpStatus", + "name" : "roundTripOpaquePointer", "parameters" : [ - + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } ], "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } } } }, { - "abiName" : "bjs_processTheme", + "abiName" : "bjs_roundTripUnsafePointer", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "processTheme", + "name" : "roundTripUnsafePointer", "parameters" : [ { - "label" : "_", - "name" : "theme", + "label" : "v", + "name" : "v", "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } } } } ], "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } } } }, { - "abiName" : "bjs_setTSDirection", + "abiName" : "bjs_roundTripUnsafeMutablePointer", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "setTSDirection", + "name" : "roundTripUnsafeMutablePointer", "parameters" : [ { - "label" : "_", - "name" : "direction", + "label" : "v", + "name" : "v", "type" : { - "caseEnum" : { - "_0" : "TSDirection" + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } } } } ], "returnType" : { - "caseEnum" : { - "_0" : "TSDirection" + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } } } }, { - "abiName" : "bjs_getTSDirection", + "abiName" : "bjs_roundTripJSObject", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getTSDirection", + "name" : "roundTripJSObject", "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "jsObject" : { + } + } + } ], "returnType" : { - "caseEnum" : { - "_0" : "TSDirection" + "jsObject" : { + } } }, { - "abiName" : "bjs_setTSTheme", + "abiName" : "bjs_roundTripDictionaryExport", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "setTSTheme", + "name" : "roundTripDictionaryExport", "parameters" : [ { - "label" : "_", - "name" : "theme", + "label" : "v", + "name" : "v", "type" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" + "dictionary" : { + "_0" : { + "int" : { + + } + } } } } ], "returnType" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" + "dictionary" : { + "_0" : { + "int" : { + + } + } } } }, { - "abiName" : "bjs_getTSTheme", + "abiName" : "bjs_roundTripOptionalDictionaryExport", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getTSTheme", + "name" : "roundTripOptionalDictionaryExport", "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + } + } + } + }, + "_1" : "null" + } + } + } ], "returnType" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_createConverter", + "abiName" : "bjs_roundTripJSValue", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "createConverter", + "name" : "roundTripJSValue", "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "jsValue" : { + } + } + } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" + "jsValue" : { + } } }, { - "abiName" : "bjs_useConverter", + "abiName" : "bjs_roundTripOptionalJSValue", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "useConverter", + "name" : "roundTripOptionalJSValue", "parameters" : [ { - "label" : "converter", - "name" : "converter", - "type" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" - } - } - }, - { - "label" : "value", - "name" : "value", + "label" : "v", + "name" : "v", "type" : { - "int" : { + "nullable" : { + "_0" : { + "jsValue" : { + } + }, + "_1" : "null" } } } ], "returnType" : { - "string" : { + "nullable" : { + "_0" : { + "jsValue" : { + } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripConverterArray", + "abiName" : "bjs_roundTripOptionalJSValueArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripConverterArray", + "name" : "roundTripOptionalJSValueArray", "parameters" : [ { - "label" : "_", - "name" : "converters", + "label" : "v", + "name" : "v", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" + "array" : { + "_0" : { + "jsValue" : { + + } + } } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" + "array" : { + "_0" : { + "jsValue" : { + + } + } } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_createHTTPServer", + "abiName" : "bjs_makeImportedFoo", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "createHTTPServer", + "name" : "makeImportedFoo", "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + } + } + } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "Networking.API.HTTPServer" + "jsObject" : { + "_0" : "Foo" } } }, { - "abiName" : "bjs_createUUID", + "abiName" : "bjs_throwsSwiftError", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "createUUID", + "name" : "throwsSwiftError", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "shouldThrow", + "name" : "shouldThrow", "type" : { - "string" : { + "bool" : { } } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "UUID" + "void" : { + } } }, { - "abiName" : "bjs_roundTripUUID", + "abiName" : "bjs_throwsWithIntResult", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "roundTripUUID", + "name" : "throwsWithIntResult", "parameters" : [ - { - "label" : "_", - "name" : "uuid", - "type" : { - "swiftHeapObject" : { - "_0" : "UUID" - } - } - } + ], "returnType" : { - "swiftHeapObject" : { - "_0" : "UUID" + "int" : { + } } }, { - "abiName" : "bjs_roundtripNetworkingAPIMethod", + "abiName" : "bjs_throwsWithStringResult", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "roundtripNetworkingAPIMethod", + "name" : "throwsWithStringResult", "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } + ], "returnType" : { - "caseEnum" : { - "_0" : "Networking.API.Method" + "string" : { + } } }, { - "abiName" : "bjs_roundtripConfigurationLogLevel", + "abiName" : "bjs_throwsWithBoolResult", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "roundtripConfigurationLogLevel", + "name" : "throwsWithBoolResult", "parameters" : [ - { - "label" : "_", - "name" : "level", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" - } - } - } + ], "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" + "bool" : { + } } }, { - "abiName" : "bjs_roundtripConfigurationPort", + "abiName" : "bjs_throwsWithFloatResult", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "roundtripConfigurationPort", + "name" : "throwsWithFloatResult", "parameters" : [ - { - "label" : "_", - "name" : "port", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" - } - } - } + ], "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" + "float" : { + } } }, { - "abiName" : "bjs_processConfigurationLogLevel", + "abiName" : "bjs_throwsWithDoubleResult", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "processConfigurationLogLevel", + "name" : "throwsWithDoubleResult", "parameters" : [ - { - "label" : "_", - "name" : "level", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" - } - } - } + ], "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" + "double" : { + } } }, { - "abiName" : "bjs_roundtripInternalSupportedMethod", + "abiName" : "bjs_throwsWithSwiftHeapObjectResult", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "roundtripInternalSupportedMethod", + "name" : "throwsWithSwiftHeapObjectResult", "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Internal.SupportedMethod" - } - } - } + ], "returnType" : { - "caseEnum" : { - "_0" : "Internal.SupportedMethod" + "swiftHeapObject" : { + "_0" : "Greeter" } } }, { - "abiName" : "bjs_roundtripAPIResult", + "abiName" : "bjs_throwsWithJSObjectResult", "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, - "name" : "roundtripAPIResult", + "name" : "throwsWithJSObjectResult", "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } + ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "jsObject" : { + } } }, { - "abiName" : "bjs_makeAPIResultSuccess", + "abiName" : "bjs_asyncRoundTripVoid", "effects" : { - "isAsync" : false, + "isAsync" : true, "isStatic" : false, "isThrows" : false }, - "name" : "makeAPIResultSuccess", + "name" : "asyncRoundTripVoid", "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - } - } - } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "void" : { + } } }, { - "abiName" : "bjs_makeAPIResultFailure", + "abiName" : "bjs_asyncRoundTripInt", "effects" : { - "isAsync" : false, + "isAsync" : true, "isStatic" : false, "isThrows" : false }, - "name" : "makeAPIResultFailure", + "name" : "asyncRoundTripInt", "parameters" : [ { - "label" : "_", - "name" : "value", + "label" : "v", + "name" : "v", "type" : { "int" : { @@ -9921,251 +10235,233 @@ } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "int" : { + } } }, { - "abiName" : "bjs_makeAPIResultInfo", + "abiName" : "bjs_asyncRoundTripFloat", "effects" : { - "isAsync" : false, + "isAsync" : true, "isStatic" : false, "isThrows" : false }, - "name" : "makeAPIResultInfo", + "name" : "asyncRoundTripFloat", "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "float" : { + } + } + } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "float" : { + } } }, { - "abiName" : "bjs_makeAPIResultFlag", + "abiName" : "bjs_asyncRoundTripDouble", "effects" : { - "isAsync" : false, + "isAsync" : true, "isStatic" : false, "isThrows" : false }, - "name" : "makeAPIResultFlag", + "name" : "asyncRoundTripDouble", "parameters" : [ { - "label" : "_", - "name" : "value", + "label" : "v", + "name" : "v", "type" : { - "bool" : { + "double" : { } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "double" : { + } } }, { - "abiName" : "bjs_makeAPIResultRate", + "abiName" : "bjs_asyncRoundTripBool", "effects" : { - "isAsync" : false, + "isAsync" : true, "isStatic" : false, "isThrows" : false }, - "name" : "makeAPIResultRate", + "name" : "asyncRoundTripBool", "parameters" : [ { - "label" : "_", - "name" : "value", + "label" : "v", + "name" : "v", "type" : { - "float" : { + "bool" : { } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "bool" : { + } } }, { - "abiName" : "bjs_makeAPIResultPrecise", + "abiName" : "bjs_asyncRoundTripString", "effects" : { - "isAsync" : false, + "isAsync" : true, "isStatic" : false, "isThrows" : false }, - "name" : "makeAPIResultPrecise", + "name" : "asyncRoundTripString", "parameters" : [ { - "label" : "_", - "name" : "value", + "label" : "v", + "name" : "v", "type" : { - "double" : { + "string" : { } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "string" : { + } } }, { - "abiName" : "bjs_roundtripComplexResult", + "abiName" : "bjs_asyncRoundTripSwiftHeapObject", "effects" : { - "isAsync" : false, + "isAsync" : true, "isStatic" : false, "isThrows" : false }, - "name" : "roundtripComplexResult", + "name" : "asyncRoundTripSwiftHeapObject", "parameters" : [ { - "label" : "_", - "name" : "result", + "label" : "v", + "name" : "v", "type" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "swiftHeapObject" : { + "_0" : "Greeter" } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "swiftHeapObject" : { + "_0" : "Greeter" } } }, { - "abiName" : "bjs_makeComplexResultSuccess", + "abiName" : "bjs_asyncRoundTripJSObject", "effects" : { - "isAsync" : false, + "isAsync" : true, "isStatic" : false, "isThrows" : false }, - "name" : "makeComplexResultSuccess", + "name" : "asyncRoundTripJSObject", "parameters" : [ { - "label" : "_", - "name" : "value", + "label" : "v", + "name" : "v", "type" : { - "string" : { + "jsObject" : { } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "jsObject" : { + } } }, { - "abiName" : "bjs_makeComplexResultError", + "abiName" : "bjs_takeGreeter", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeComplexResultError", + "name" : "takeGreeter", "parameters" : [ { - "label" : "_", - "name" : "message", + "label" : "g", + "name" : "g", "type" : { - "string" : { - + "swiftHeapObject" : { + "_0" : "Greeter" } } }, { - "label" : "_", - "name" : "code", + "label" : "name", + "name" : "name", "type" : { - "int" : { + "string" : { } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "void" : { + } } }, { - "abiName" : "bjs_makeComplexResultLocation", + "abiName" : "bjs_createCalculator", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeComplexResultLocation", + "name" : "createCalculator", "parameters" : [ - { - "label" : "_", - "name" : "lat", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "lng", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "name", - "type" : { - "string" : { - } - } - } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "swiftHeapObject" : { + "_0" : "Calculator" } } }, { - "abiName" : "bjs_makeComplexResultStatus", + "abiName" : "bjs_useCalculator", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeComplexResultStatus", + "name" : "useCalculator", "parameters" : [ { - "label" : "_", - "name" : "active", + "label" : "calc", + "name" : "calc", "type" : { - "bool" : { - + "swiftHeapObject" : { + "_0" : "Calculator" } } }, { - "label" : "_", - "name" : "code", + "label" : "x", + "name" : "x", "type" : { "int" : { @@ -10173,1798 +10469,1555 @@ } }, { - "label" : "_", - "name" : "message", + "label" : "y", + "name" : "y", "type" : { - "string" : { + "int" : { } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "int" : { + } } }, { - "abiName" : "bjs_makeComplexResultCoordinates", + "abiName" : "bjs_testGreeterToJSValue", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeComplexResultCoordinates", + "name" : "testGreeterToJSValue", "parameters" : [ - { - "label" : "_", - "name" : "x", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "y", - "type" : { - "double" : { - } - } - }, - { - "label" : "_", - "name" : "z", - "type" : { - "double" : { - - } - } - } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "jsObject" : { + } } }, { - "abiName" : "bjs_makeComplexResultComprehensive", + "abiName" : "bjs_testCalculatorToJSValue", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeComplexResultComprehensive", + "name" : "testCalculatorToJSValue", "parameters" : [ - { - "label" : "_", - "name" : "flag1", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "flag2", - "type" : { - "bool" : { - } - } - }, - { - "label" : "_", - "name" : "count1", - "type" : { - "int" : { + ], + "returnType" : { + "jsObject" : { - } - } - }, + } + } + }, + { + "abiName" : "bjs_testSwiftClassAsJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testSwiftClassAsJSValue", + "parameters" : [ { - "label" : "_", - "name" : "count2", + "label" : "greeter", + "name" : "greeter", "type" : { - "int" : { - + "swiftHeapObject" : { + "_0" : "Greeter" } } - }, - { - "label" : "_", - "name" : "value1", - "type" : { - "double" : { + } + ], + "returnType" : { + "jsObject" : { - } - } - }, + } + } + }, + { + "abiName" : "bjs_setDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setDirection", + "parameters" : [ { "label" : "_", - "name" : "value2", + "name" : "direction", "type" : { - "double" : { - + "caseEnum" : { + "_0" : "Direction" } } - }, - { - "label" : "_", - "name" : "text1", - "type" : { - "string" : { + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "abiName" : "bjs_getDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getDirection", + "parameters" : [ - } - } - }, + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "abiName" : "bjs_processDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirection", + "parameters" : [ { "label" : "_", - "name" : "text2", + "name" : "input", "type" : { - "string" : { - + "caseEnum" : { + "_0" : "Direction" } } - }, + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "abiName" : "bjs_setTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTheme", + "parameters" : [ { "label" : "_", - "name" : "text3", + "name" : "theme", "type" : { - "string" : { - + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } }, { - "abiName" : "bjs_makeComplexResultInfo", + "abiName" : "bjs_getTheme", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeComplexResultInfo", + "name" : "getTheme", "parameters" : [ ], "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } }, { - "abiName" : "bjs_makeUtilitiesResultSuccess", + "abiName" : "bjs_setHttpStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeUtilitiesResultSuccess", + "name" : "setHttpStatus", "parameters" : [ { "label" : "_", - "name" : "message", + "name" : "status", "type" : { - "string" : { - + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } }, { - "abiName" : "bjs_makeUtilitiesResultFailure", + "abiName" : "bjs_getHttpStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeUtilitiesResultFailure", + "name" : "getHttpStatus", "parameters" : [ - { - "label" : "_", - "name" : "error", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "int" : { - } - } - } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } }, { - "abiName" : "bjs_makeUtilitiesResultStatus", + "abiName" : "bjs_processTheme", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeUtilitiesResultStatus", + "name" : "processTheme", "parameters" : [ { "label" : "_", - "name" : "active", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "int" : { - - } - } - }, - { - "label" : "_", - "name" : "message", + "name" : "theme", "type" : { - "string" : { - + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } }, { - "abiName" : "bjs_makeAPINetworkingResultSuccess", + "abiName" : "bjs_setTSDirection", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeAPINetworkingResultSuccess", + "name" : "setTSDirection", "parameters" : [ { "label" : "_", - "name" : "message", + "name" : "direction", "type" : { - "string" : { - + "caseEnum" : { + "_0" : "TSDirection" } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" + "caseEnum" : { + "_0" : "TSDirection" } } }, { - "abiName" : "bjs_makeAPINetworkingResultFailure", + "abiName" : "bjs_getTSDirection", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeAPINetworkingResultFailure", + "name" : "getTSDirection", "parameters" : [ - { - "label" : "_", - "name" : "error", - "type" : { - "string" : { - } - } - }, + ], + "returnType" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + }, + { + "abiName" : "bjs_setTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTSTheme", + "parameters" : [ { "label" : "_", - "name" : "code", + "name" : "theme", "type" : { - "int" : { - + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" } } }, { - "abiName" : "bjs_roundtripUtilitiesResult", + "abiName" : "bjs_getTSTheme", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundtripUtilitiesResult", + "name" : "getTSTheme", "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" } + } + }, + { + "abiName" : "bjs_createConverter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createConverter", + "parameters" : [ + ], "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" + "swiftHeapObject" : { + "_0" : "Utils.Converter" } } }, { - "abiName" : "bjs_roundtripAPINetworkingResult", + "abiName" : "bjs_useConverter", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundtripAPINetworkingResult", + "name" : "useConverter", "parameters" : [ { - "label" : "_", - "name" : "result", + "label" : "converter", + "name" : "converter", "type" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } + }, + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" + "string" : { + } } }, { - "abiName" : "bjs_roundTripAllTypesResult", + "abiName" : "bjs_roundTripConverterArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripAllTypesResult", + "name" : "roundTripConverterArray", "parameters" : [ { "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "name" : "converters", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } } } }, { - "abiName" : "bjs_roundTripTypedPayloadResult", + "abiName" : "bjs_createHTTPServer", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripTypedPayloadResult", + "name" : "createHTTPServer", "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - } - } + ], "returnType" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" + "swiftHeapObject" : { + "_0" : "Networking.API.HTTPServer" } } }, { - "abiName" : "bjs_createPropertyHolder", + "abiName" : "bjs_createUUID", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "createPropertyHolder", + "name" : "createUUID", "parameters" : [ { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "label" : "floatValue", - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "label" : "doubleValue", - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "label" : "boolValue", - "name" : "boolValue", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "stringValue", - "name" : "stringValue", + "label" : "value", + "name" : "value", "type" : { "string" : { - } - } - }, - { - "label" : "jsObject", - "name" : "jsObject", - "type" : { - "jsObject" : { - } } } ], "returnType" : { "swiftHeapObject" : { - "_0" : "PropertyHolder" + "_0" : "UUID" } } }, { - "abiName" : "bjs_testPropertyHolder", + "abiName" : "bjs_roundTripUUID", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testPropertyHolder", + "name" : "roundTripUUID", "parameters" : [ { - "label" : "holder", - "name" : "holder", + "label" : "_", + "name" : "uuid", "type" : { "swiftHeapObject" : { - "_0" : "PropertyHolder" + "_0" : "UUID" } } } ], "returnType" : { - "string" : { - + "swiftHeapObject" : { + "_0" : "UUID" } } }, { - "abiName" : "bjs_resetObserverCounts", + "abiName" : "bjs_roundtripNetworkingAPIMethod", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "resetObserverCounts", + "name" : "roundtripNetworkingAPIMethod", "parameters" : [ - + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } ], "returnType" : { - "void" : { - + "caseEnum" : { + "_0" : "Networking.API.Method" } } }, { - "abiName" : "bjs_getObserverStats", + "abiName" : "bjs_roundtripConfigurationLogLevel", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getObserverStats", + "name" : "roundtripConfigurationLogLevel", "parameters" : [ - + { + "label" : "_", + "name" : "level", + "type" : { + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" + } + } + } ], "returnType" : { - "string" : { - + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" } } }, { - "abiName" : "bjs_formatName", + "abiName" : "bjs_roundtripConfigurationPort", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "formatName", + "name" : "roundtripConfigurationPort", "parameters" : [ { "label" : "_", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "label" : "transform", - "name" : "transform", + "name" : "port", "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - "useJSTypedClosure" : false + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" } } } ], "returnType" : { - "string" : { - + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" } } }, { - "abiName" : "bjs_makeFormatter", + "abiName" : "bjs_processConfigurationLogLevel", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeFormatter", + "name" : "processConfigurationLogLevel", "parameters" : [ { - "label" : "prefix", - "name" : "prefix", + "label" : "_", + "name" : "level", "type" : { - "string" : { - + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" } } } ], "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - "useJSTypedClosure" : false + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" } } }, { - "abiName" : "bjs_makeAdder", + "abiName" : "bjs_roundtripInternalSupportedMethod", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeAdder", + "name" : "roundtripInternalSupportedMethod", "parameters" : [ { - "label" : "base", - "name" : "base", + "label" : "_", + "name" : "method", "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - "useJSTypedClosure" : false + "caseEnum" : { + "_0" : "Internal.SupportedMethod" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Internal.SupportedMethod" } } }, { - "abiName" : "bjs_roundTripOptionalIntArrayType", + "abiName" : "bjs_roundtripAPIResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalIntArrayType", + "name" : "roundtripAPIResult", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "result", + "name" : "result", "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIResult" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIResult" } } }, { - "abiName" : "bjs_roundTripOptionalStringArrayType", + "abiName" : "bjs_makeAPIResultSuccess", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStringArrayType", + "name" : "makeAPIResultSuccess", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "value", "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { + "string" : { - } - } - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIResult" } } }, { - "abiName" : "bjs_roundTripOptionalGreeterArrayType", + "abiName" : "bjs_makeAPIResultFailure", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalGreeterArrayType", + "name" : "makeAPIResultFailure", "parameters" : [ { "label" : "_", - "name" : "greeters", + "name" : "value", "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - }, - "_1" : "null" + "int" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIResult" } } }, { - "abiName" : "bjs_roundTripOptionalString", + "abiName" : "bjs_makeAPIResultInfo", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalString", + "name" : "makeAPIResultInfo", "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "nullable" : { - "_0" : { - "string" : { - } - }, - "_1" : "null" - } - } - } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIResult" } } }, { - "abiName" : "bjs_roundTripOptionalInt", + "abiName" : "bjs_makeAPIResultFlag", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalInt", + "name" : "makeAPIResultFlag", "parameters" : [ { - "label" : "value", + "label" : "_", "name" : "value", "type" : { - "nullable" : { - "_0" : { - "int" : { + "bool" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIResult" } } }, { - "abiName" : "bjs_roundTripOptionalBool", + "abiName" : "bjs_makeAPIResultRate", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalBool", + "name" : "makeAPIResultRate", "parameters" : [ { - "label" : "flag", - "name" : "flag", + "label" : "_", + "name" : "value", "type" : { - "nullable" : { - "_0" : { - "bool" : { + "float" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIResult" } } }, { - "abiName" : "bjs_roundTripOptionalFloat", + "abiName" : "bjs_makeAPIResultPrecise", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalFloat", + "name" : "makeAPIResultPrecise", "parameters" : [ { - "label" : "number", - "name" : "number", + "label" : "_", + "name" : "value", "type" : { - "nullable" : { - "_0" : { - "float" : { + "double" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "float" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIResult" } } }, { - "abiName" : "bjs_roundTripOptionalDouble", + "abiName" : "bjs_roundtripComplexResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalDouble", + "name" : "roundtripComplexResult", "parameters" : [ { - "label" : "precision", - "name" : "precision", + "label" : "_", + "name" : "result", "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } }, { - "abiName" : "bjs_roundTripOptionalSyntax", + "abiName" : "bjs_makeComplexResultSuccess", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalSyntax", + "name" : "makeComplexResultSuccess", "parameters" : [ { - "label" : "name", - "name" : "name", + "label" : "_", + "name" : "value", "type" : { - "nullable" : { - "_0" : { - "string" : { + "string" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } }, { - "abiName" : "bjs_roundTripOptionalMixSyntax", + "abiName" : "bjs_makeComplexResultError", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalMixSyntax", + "name" : "makeComplexResultError", "parameters" : [ { - "label" : "name", - "name" : "name", + "label" : "_", + "name" : "message", "type" : { - "nullable" : { - "_0" : { - "string" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } }, { - "abiName" : "bjs_roundTripOptionalSwiftSyntax", + "abiName" : "bjs_makeComplexResultLocation", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalSwiftSyntax", + "name" : "makeComplexResultLocation", "parameters" : [ { - "label" : "name", + "label" : "_", + "name" : "lat", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "lng", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", "name" : "name", "type" : { - "nullable" : { - "_0" : { - "string" : { + "string" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } }, { - "abiName" : "bjs_roundTripOptionalWithSpaces", + "abiName" : "bjs_makeComplexResultStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalWithSpaces", + "name" : "makeComplexResultStatus", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "active", "type" : { - "nullable" : { - "_0" : { - "double" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } }, { - "abiName" : "bjs_roundTripOptionalTypeAlias", + "abiName" : "bjs_makeComplexResultCoordinates", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTypeAlias", + "name" : "makeComplexResultCoordinates", "parameters" : [ { - "label" : "age", - "name" : "age", + "label" : "_", + "name" : "x", "type" : { - "nullable" : { - "_0" : { - "int" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "y", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "z", + "type" : { + "double" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } }, { - "abiName" : "bjs_roundTripOptionalStatus", + "abiName" : "bjs_makeComplexResultComprehensive", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStatus", + "name" : "makeComplexResultComprehensive", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "flag1", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "flag2", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "count1", + "type" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "count2", + "type" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "value1", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "value2", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "text1", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "text2", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "text3", + "type" : { + "string" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } }, { - "abiName" : "bjs_roundTripOptionalTheme", + "abiName" : "bjs_makeComplexResultInfo", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTheme", + "name" : "makeComplexResultInfo", "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - } + ], "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "ComplexResult" } } }, { - "abiName" : "bjs_roundTripOptionalHttpStatus", + "abiName" : "bjs_makeUtilitiesResultSuccess", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalHttpStatus", + "name" : "makeUtilitiesResultSuccess", "parameters" : [ { - "label" : "value", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" + "label" : "_", + "name" : "message", + "type" : { + "string" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "Utilities.Result" } } }, { - "abiName" : "bjs_roundTripOptionalTSDirection", + "abiName" : "bjs_makeUtilitiesResultFailure", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTSDirection", + "name" : "makeUtilitiesResultFailure", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "error", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - }, - "_1" : "null" + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "Utilities.Result" } } }, { - "abiName" : "bjs_roundTripOptionalTSTheme", + "abiName" : "bjs_makeUtilitiesResultStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTSTheme", + "name" : "makeUtilitiesResultStatus", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "active", "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - }, - "_1" : "null" + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "Utilities.Result" } } }, { - "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", + "abiName" : "bjs_makeAPINetworkingResultSuccess", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalNetworkingAPIMethod", + "name" : "makeAPINetworkingResultSuccess", "parameters" : [ { "label" : "_", - "name" : "method", + "name" : "message", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - }, - "_1" : "null" + "string" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" } } }, { - "abiName" : "bjs_roundTripOptionalAPIResult", + "abiName" : "bjs_makeAPINetworkingResultFailure", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAPIResult", + "name" : "makeAPINetworkingResultFailure", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "error", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" } } }, { - "abiName" : "bjs_roundTripOptionalTypedPayloadResult", + "abiName" : "bjs_roundtripUtilitiesResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTypedPayloadResult", + "name" : "roundtripUtilitiesResult", "parameters" : [ { "label" : "_", "name" : "result", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "Utilities.Result" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "Utilities.Result" } } }, { - "abiName" : "bjs_takeOptionalJSObject", + "abiName" : "bjs_roundtripAPINetworkingResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "takeOptionalJSObject", + "name" : "roundtripAPINetworkingResult", "parameters" : [ { "label" : "_", - "name" : "value", + "name" : "result", "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" } } } ], "returnType" : { - "void" : { - + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" } } }, { - "abiName" : "bjs_compareAPIResults", + "abiName" : "bjs_roundTripAllTypesResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "compareAPIResults", + "name" : "roundTripAllTypesResult", "parameters" : [ { "label" : "_", - "name" : "r1", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "_", - "name" : "r2", + "name" : "result", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "AllTypesResult" } } } ], "returnType" : { - "string" : { - + "associatedValueEnum" : { + "_0" : "AllTypesResult" } } }, { - "abiName" : "bjs_roundTripOptionalComplexResult", + "abiName" : "bjs_roundTripTypedPayloadResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalComplexResult", + "name" : "roundTripTypedPayloadResult", "parameters" : [ { "label" : "_", "name" : "result", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } } }, { - "abiName" : "bjs_roundTripOptionalAllTypesResult", + "abiName" : "bjs_createPropertyHolder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAllTypesResult", + "name" : "createPropertyHolder", "parameters" : [ { - "label" : "_", - "name" : "result", + "label" : "intValue", + "name" : "intValue", + "type" : { + "int" : { + + } + } + }, + { + "label" : "floatValue", + "name" : "floatValue", + "type" : { + "float" : { + + } + } + }, + { + "label" : "doubleValue", + "name" : "doubleValue", + "type" : { + "double" : { + + } + } + }, + { + "label" : "boolValue", + "name" : "boolValue", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" - } - }, - "_1" : "null" + "bool" : { + } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + }, + { + "label" : "stringValue", + "name" : "stringValue", + "type" : { + "string" : { + } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalPayloadResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalPayloadResult", - "parameters" : [ + } + }, { - "label" : "_", - "name" : "result", + "label" : "jsObject", + "name" : "jsObject", "type" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "jsObject" : { + } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "swiftHeapObject" : { + "_0" : "PropertyHolder" } } }, { - "abiName" : "bjs_roundTripOptionalPayloadResultOpt", + "abiName" : "bjs_testPropertyHolder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalPayloadResultOpt", + "name" : "testPropertyHolder", "parameters" : [ { - "label" : "_", - "name" : "result", + "label" : "holder", + "name" : "holder", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "PropertyHolder" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" - } - }, - "_1" : "null" + "string" : { + } } }, { - "abiName" : "bjs_roundTripOptionalClass", + "abiName" : "bjs_resetObserverCounts", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalClass", + "name" : "resetObserverCounts", "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } + ], "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" + "void" : { + } } }, { - "abiName" : "bjs_roundTripOptionalGreeter", + "abiName" : "bjs_getObserverStats", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalGreeter", + "name" : "getObserverStats", "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } + ], "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" + "string" : { + } } }, { - "abiName" : "bjs_applyOptionalGreeter", + "abiName" : "bjs_formatName", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "applyOptionalGreeter", + "name" : "formatName", "parameters" : [ { "label" : "_", - "name" : "value", + "name" : "name", "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" + "string" : { + } } }, { - "label" : "_", + "label" : "transform", "name" : "transform", "type" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC", + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" + "string" : { + } } ], "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" + "string" : { + } } }, @@ -11974,92 +12027,94 @@ } ], "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" + "string" : { + } } }, { - "abiName" : "bjs_makeOptionalHolder", + "abiName" : "bjs_makeFormatter", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeOptionalHolder", + "name" : "makeFormatter", "parameters" : [ { - "label" : "nullableGreeter", - "name" : "nullableGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "undefinedNumber", - "name" : "undefinedNumber", + "label" : "prefix", + "name" : "prefix", "type" : { - "nullable" : { - "_0" : { - "double" : { + "string" : { - } - }, - "_1" : "undefined" } } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "OptionalHolder" + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + "useJSTypedClosure" : false } } }, { - "abiName" : "bjs_roundTripOptionalAPIOptionalResult", + "abiName" : "bjs_makeAdder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAPIOptionalResult", + "name" : "makeAdder", "parameters" : [ { - "label" : "result", - "name" : "result", + "label" : "base", + "name" : "base", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - }, - "_1" : "null" + "int" : { + } } } ], "returnType" : { - "nullable" : { + "closure" : { "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } } }, - "_1" : "null" + "useJSTypedClosure" : false } } }, diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs index 1a41cc43..aaa05a70 100644 --- a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs +++ b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs @@ -48,9 +48,11 @@ export function getImports(importsContext) { /** * Optional value bridging coverage for BridgeJS runtime tests. - * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} rootExports */ -export function runJsOptionalSupportTests(exports) { +export function runJsOptionalSupportTests(rootExports) { + const exports = rootExports.OptionalSupportExports; + const { Status, Theme, HttpStatus, Networking, ComplexResult, APIResult, Greeter, OptionalPropertyHolder, TypedPayloadResult, Direction } = rootExports; assert.equal(exports.roundTripOptionalString(null), null); assert.equal(exports.roundTripOptionalInt(null), null); assert.equal(exports.roundTripOptionalBool(null), null); @@ -65,47 +67,45 @@ export function runJsOptionalSupportTests(exports) { 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.equal(exports.roundTripOptionalCaseEnum(Status.Success), StatusValues.Success); + assert.equal(exports.roundTripOptionalStringRawValueEnum(Theme.Light), ThemeValues.Light); + assert.equal(exports.roundTripOptionalIntRawValueEnum(HttpStatus.Ok), HttpStatusValues.Ok); + assert.equal(exports.roundTripOptionalTSEnum(TSDirection.North), TSDirection.North); + assert.equal(exports.roundTripOptionalTSStringEnum(TSTheme.Light), TSTheme.Light); + assert.equal(exports.roundTripOptionalNamespacedEnum(Networking.API.Method.Get), Networking.API.Method.Get); + + // Optional arrays + assert.deepEqual(exports.roundTripOptionalIntArray([1, 2, 3]), [1, 2, 3]); + assert.equal(exports.roundTripOptionalIntArray(null), null); + assert.deepEqual(exports.roundTripOptionalStringArray(["a", "b"]), ["a", "b"]); + assert.equal(exports.roundTripOptionalStringArray(null), null); 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' }; + const cl1 = { tag: 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 }; + const apiSuccess = { tag: APIResult.Tag.Success, param0: 'test success' }; + const apiFailure = { tag: APIResult.Tag.Failure, param0: 404 }; + const apiInfo = { tag: 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); + const optionalGreeter = new Greeter('Schrödinger'); + const optionalGreeter2 = exports.roundTripOptionalSwiftClass(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); + assert.equal(exports.roundTripOptionalSwiftClass(null), null); optionalGreeter.release(); optionalGreeter2?.release(); - const optionalsHolder = new exports.OptionalPropertyHolder(null); + const optionalsHolder = new OptionalPropertyHolder(null); assert.equal(optionalsHolder.optionalName, null); assert.equal(optionalsHolder.optionalAge, null); @@ -116,7 +116,7 @@ export function runJsOptionalSupportTests(exports) { assert.equal(optionalsHolder.optionalName, 'Alice'); assert.equal(optionalsHolder.optionalAge, 25); - const testPropertyGreeter = new exports.Greeter('Bob'); + const testPropertyGreeter = new Greeter('Bob'); optionalsHolder.optionalGreeter = testPropertyGreeter; assert.equal(optionalsHolder.optionalGreeter.greet(), 'Hello, Bob!'); assert.equal(optionalsHolder.optionalGreeter.name, 'Bob'); @@ -130,14 +130,14 @@ export function runJsOptionalSupportTests(exports) { testPropertyGreeter.release(); optionalsHolder.release(); - const optGreeter = new exports.Greeter('Optionaly'); - assert.equal(exports.roundTripOptionalGreeter(null), null); - const optGreeterReturned = exports.roundTripOptionalGreeter(optGreeter); - assert.equal(optGreeterReturned.name, 'Optionaly'); - assert.equal(optGreeterReturned.greet(), 'Hello, Optionaly!'); + const optGreeter = new Greeter('Optionaly'); + assert.equal(exports.roundTripOptionalSwiftClass(null), null); + const optGreeterReturned = exports.roundTripOptionalSwiftClass(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'); + assert.equal(appliedOptional?.name, 'Optionaly'); const holderOpt = exports.makeOptionalHolder(null, undefined); assert.equal(holderOpt.nullableGreeter, null); @@ -147,7 +147,7 @@ export function runJsOptionalSupportTests(exports) { assert.equal(holderOpt.nullableGreeter.name, 'Optionaly'); assert.equal(holderOpt.undefinedNumber, 123.5); holderOpt.release(); - optGreeterReturned.release(); + optGreeterReturned?.release(); optGreeter.release(); const aor1 = { tag: APIOptionalResultValues.Tag.Success, param0: 'hello world' }; @@ -174,15 +174,25 @@ export function runJsOptionalSupportTests(exports) { assert.equal(exports.roundTripOptionalAPIOptionalResult(null), null); // Optional TypedPayloadResult roundtrip - const tpr_precision = { tag: exports.TypedPayloadResult.Tag.Precision, param0: Math.fround(0.1) }; + /** + * @typedef {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').TypedPayloadResultTag} TypedPayloadResultTag + * @typedef {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').PrecisionTag} PrecisionTag + */ + + /** @type {TypedPayloadResultTag} */ + const tpr_precision = { tag: TypedPayloadResult.Tag.Precision, param0: /** @type {PrecisionTag} */ (Math.fround(0.1)) }; assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_precision), tpr_precision); - const tpr_direction = { tag: exports.TypedPayloadResult.Tag.Direction, param0: exports.Direction.North }; + /** @type {TypedPayloadResultTag} */ + const tpr_direction = { tag: TypedPayloadResult.Tag.Direction, param0: Direction.North }; assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_direction), tpr_direction); - const tpr_optPrecisionSome = { tag: exports.TypedPayloadResult.Tag.OptPrecision, param0: Math.fround(0.001) }; + /** @type {TypedPayloadResultTag} */ + const tpr_optPrecisionSome = { tag: TypedPayloadResult.Tag.OptPrecision, param0: /** @type {PrecisionTag} */ (Math.fround(0.001)) }; assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionSome), tpr_optPrecisionSome); - const tpr_optPrecisionNull = { tag: exports.TypedPayloadResult.Tag.OptPrecision, param0: null }; + /** @type {TypedPayloadResultTag} */ + const tpr_optPrecisionNull = { tag: TypedPayloadResult.Tag.OptPrecision, param0: null }; assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionNull), tpr_optPrecisionNull); - const tpr_empty = { tag: exports.TypedPayloadResult.Tag.Empty }; + /** @type {TypedPayloadResultTag} */ + const tpr_empty = { tag: TypedPayloadResult.Tag.Empty }; assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_empty), tpr_empty); assert.equal(exports.roundTripOptionalTypedPayloadResult(null), null); @@ -202,10 +212,12 @@ export function runJsOptionalSupportTests(exports) { 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 = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: new 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"); + if (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); @@ -213,7 +225,9 @@ export function runJsOptionalSupportTests(exports) { 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"); + if (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); @@ -233,7 +247,9 @@ export function runJsOptionalSupportTests(exports) { 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"); + if (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); diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift index c8cc9894..520a608a 100644 --- a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -83,115 +83,70 @@ final class OptionalSupportTests: XCTestCase { // } } -// MARK: - Optional Bridging - -@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 takeOptionalJSObject(_ value: JSObject?) {} - -@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)" +@JS enum OptionalSupportExports { + @JS static func roundTripOptionalString(_ v: String?) -> String? { v } + @JS static func roundTripOptionalInt(_ v: Int?) -> Int? { v } + @JS static func roundTripOptionalBool(_ v: Bool?) -> Bool? { v } + @JS static func roundTripOptionalFloat(_ v: Float?) -> Float? { v } + @JS static func roundTripOptionalDouble(_ v: Double?) -> Double? { v } + @JS static func roundTripOptionalSyntax(_ v: Optional) -> Optional { v } + @JS static func roundTripOptionalCaseEnum(_ v: Status?) -> Status? { v } + @JS static func roundTripOptionalStringRawValueEnum(_ v: Theme?) -> Theme? { v } + @JS static func roundTripOptionalIntRawValueEnum(_ v: HttpStatus?) -> HttpStatus? { v } + @JS static func roundTripOptionalTSEnum(_ v: TSDirection?) -> TSDirection? { v } + @JS static func roundTripOptionalTSStringEnum(_ v: TSTheme?) -> TSTheme? { v } + @JS static func roundTripOptionalNamespacedEnum(_ v: Networking.API.Method?) -> Networking.API.Method? { v } + @JS static func roundTripOptionalSwiftClass(_ v: Greeter?) -> Greeter? { v } + @JS static func roundTripOptionalIntArray(_ v: [Int]?) -> [Int]? { v } + @JS static func roundTripOptionalStringArray(_ v: [String]?) -> [String]? { v } + @JS static func roundTripOptionalSwiftClassArray(_ v: [Greeter]?) -> [Greeter]? { v } + + @JS static func roundTripOptionalAPIResult(_ v: APIResult?) -> APIResult? { v } + @JS static func roundTripOptionalTypedPayloadResult(_ v: TypedPayloadResult?) -> TypedPayloadResult? { v } + @JS static func roundTripOptionalComplexResult(_ v: ComplexResult?) -> ComplexResult? { v } + @JS static func roundTripOptionalAllTypesResult(_ v: AllTypesResult?) -> AllTypesResult? { v } + @JS static func roundTripOptionalPayloadResult(_ v: OptionalAllTypesResult) -> OptionalAllTypesResult { v } + @JS static func roundTripOptionalPayloadResultOpt(_ v: OptionalAllTypesResult?) -> OptionalAllTypesResult? { v } + @JS static func roundTripOptionalAPIOptionalResult(_ v: APIOptionalResult?) -> APIOptionalResult? { v } + + @JS static func takeOptionalJSObject(_ value: JSObject?) {} + + @JS static func applyOptionalGreeter(_ value: Greeter?, _ transform: (Greeter?) -> Greeter?) -> Greeter? { + transform(value) } - 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)" + @JS static func makeOptionalHolder( + nullableGreeter: Greeter?, + undefinedNumber: JSUndefinedOr + ) -> OptionalHolder { + OptionalHolder(nullableGreeter: nullableGreeter, undefinedNumber: undefinedNumber) } - return "r1:\(r1Str),r2:\(r2Str)" -} + @JS static 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)" + } -@JS func roundTripOptionalComplexResult(_ result: ComplexResult?) -> ComplexResult? { - result -} + 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)" + } -@JS func roundTripOptionalAllTypesResult(_ result: AllTypesResult?) -> AllTypesResult? { - result + return "r1:\(r1Str),r2:\(r2Str)" + } } @JS @@ -205,26 +160,6 @@ enum OptionalAllTypesResult { 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 @@ -235,10 +170,6 @@ enum OptionalAllTypesResult { } } -@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 @@ -255,7 +186,3 @@ enum APIOptionalResult { case failure(Int?, Bool?) case status(Bool?, Int?, String?) } - -@JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult? { - result -} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 350386e4..5fa7c11d 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -789,7 +789,6 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.Services.Graph.GraphOperations.nodeCount(0), 0); testProtocolSupport(exports); - testArraySupport(exports); } /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ @@ -1149,38 +1148,6 @@ function setupTestGlobals(global) { }; } -/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ -function testArraySupport(exports) { - const { Direction, Status, Theme, HttpStatus, Greeter } = exports; - - // Optional arrays - assert.deepEqual(exports.roundTripOptionalIntArrayType([1, 2, 3]), [1, 2, 3]); - assert.equal(exports.roundTripOptionalIntArrayType(null), null); - assert.deepEqual(exports.roundTripOptionalStringArrayType(["a", "b"]), ["a", "b"]); - assert.equal(exports.roundTripOptionalStringArrayType(null), null); - const og1 = new Greeter("OptGreeter"); - const optGreeterResult = exports.roundTripOptionalGreeterArrayType([og1]); - assert.equal(optGreeterResult[0].name, "OptGreeter"); - assert.equal(exports.roundTripOptionalGreeterArrayType(null), null); - og1.release(); - optGreeterResult.forEach(g => g.release()); - const helper1 = new exports.Greeter("Helper1"); - const jsProcessor1 = { - count: 1, name: "Processor1", optionalTag: null, optionalCount: null, - direction: null, optionalTheme: null, httpStatus: null, apiResult: null, - helper: helper1, optionalHelper: null, - increment(by) { this.count += by; }, - getValue() { return this.count; }, - setLabelElements(a, b) { }, getLabel() { return ""; }, - isEven() { return this.count % 2 === 0; }, - processGreeter(g) { return ""; }, createGreeter() { return new exports.Greeter("P1"); }, - processOptionalGreeter(g) { return ""; }, createOptionalGreeter() { return null; }, - handleAPIResult(r) { }, getAPIResult() { return null; } - }; - - helper1.release(); -} - /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function testProtocolSupport(exports) { let processorValue = 0;