@@ -933,19 +933,10 @@ extension BridgeType {
933933 case . associatedValueEnum:
934934 return LoweringParameterInfo ( loweredParameters: [ ( " caseId " , . i32) ] )
935935 case . swiftStruct:
936- switch context {
937- case . importTS:
938- // Swift structs are bridged as JS objects (object IDs) in imported signatures.
939- return LoweringParameterInfo ( loweredParameters: [ ( " objectId " , . i32) ] )
940- case . exportSwift:
941- return LoweringParameterInfo ( loweredParameters: [ ] )
942- }
936+ // `@JS struct` parameters always use the stack ABI (same as arrays/dictionaries).
937+ return LoweringParameterInfo ( loweredParameters: [ ] )
943938 case . namespaceEnum:
944939 throw BridgeJSCoreError ( " Namespace enums cannot be used as parameters " )
945- case . nullable( . swiftStruct, _) where context == . importTS:
946- // Optional `@JS struct`s bridge through the stack (isSome discriminator + fields),
947- // like optional arrays/dictionaries, rather than the non-optional object-id ABI.
948- return LoweringParameterInfo ( loweredParameters: [ ( " isSome " , . i32) ] )
949940 case . nullable( let wrappedType, _) :
950941 let wrappedInfo = try wrappedType. loweringParameterInfo ( context: context)
951942 var params = [ ( " isSome " , WasmCoreType . i32) ]
@@ -1005,24 +996,16 @@ extension BridgeType {
1005996 case . associatedValueEnum:
1006997 return LiftingReturnInfo ( valueToLift: . i32)
1007998 case . swiftStruct:
1008- switch context {
1009- case . importTS:
1010- // Swift structs are bridged as JS objects (object IDs) in imported signatures.
1011- return LiftingReturnInfo ( valueToLift: . i32)
1012- case . exportSwift:
1013- return LiftingReturnInfo ( valueToLift: nil )
1014- }
999+ // `@JS struct` returns always use the stack ABI (same as arrays/dictionaries).
1000+ return LiftingReturnInfo ( valueToLift: nil )
10151001 case . namespaceEnum:
10161002 throw BridgeJSCoreError ( " Namespace enums cannot be used as return values " )
10171003 case . nullable( let wrappedType, _) :
1018- // jsObject and `@JS struct` use the stack ABI for optionals — the thunk returns
1019- // void and the value (plus isSome discriminator) flows through the stacks.
1004+ // jsObject uses the stack ABI for optionals — the thunk returns void and the
1005+ // value (plus isSome discriminator) flows through the stacks.
10201006 if case . jsObject = wrappedType {
10211007 return LiftingReturnInfo ( valueToLift: nil )
10221008 }
1023- if case . swiftStruct = wrappedType, context == . importTS {
1024- return LiftingReturnInfo ( valueToLift: nil )
1025- }
10261009 let wrappedInfo = try wrappedType. liftingReturnInfo ( context: context)
10271010 return LiftingReturnInfo ( valueToLift: wrappedInfo. valueToLift)
10281011 case . array, . dictionary:
0 commit comments