Skip to content

NFC: BridgeJS: Simplify liftExpression by using no-arg bridgeJSLiftParameter() for enums and protocols#623

Merged
krodak merged 1 commit intoswiftwasm:mainfrom
PassiveLogic:kr/bridgejs-lift-simplification
Feb 12, 2026
Merged

NFC: BridgeJS: Simplify liftExpression by using no-arg bridgeJSLiftParameter() for enums and protocols#623
krodak merged 1 commit intoswiftwasm:mainfrom
PassiveLogic:kr/bridgejs-lift-simplification

Conversation

@krodak
Copy link
Member

@krodak krodak commented Feb 12, 2026

Overview

Collapses the .swiftProtocol, .caseEnum, .associatedValueEnum, and .rawValueEnum cases in StackCodegen.liftExpression(for:) into the default path that uses the no-arg bridgeJSLiftParameter() form.

The runtime (BridgeJSIntrinsics.swift) already defines no-arg overloads for all these types that pop from the WASM stack internally:

  • _BridgedSwiftProtocolWrapper.bridgeJSLiftParameter() - pops i32
  • _BridgedSwiftCaseEnum.bridgeJSLiftParameter() - pops i32
  • _BridgedSwiftAssociatedValueEnum.bridgeJSLiftParameter() - pops i32
  • _BridgedSwiftRawValueEnum.bridgeJSLiftParameter() - delegates to RawValue

The codegen was redundantly doing the pop externally and passing it as an argument. This removes that duplication, making the codegen simpler and consistent with how all other types are handled.

@krodak krodak self-assigned this Feb 12, 2026
@krodak krodak force-pushed the kr/bridgejs-lift-simplification branch from 5676866 to 7829ad2 Compare February 12, 2026 09:17
@krodak krodak force-pushed the kr/bridgejs-lift-simplification branch from 7829ad2 to 8970445 Compare February 12, 2026 09:20
@krodak krodak merged commit 7018c02 into swiftwasm:main Feb 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants