Skip to content

Comments

BridgeJS: fix namespaced Swift class access in JS codegen#668

Merged
krodak merged 1 commit intoswiftwasm:mainfrom
PassiveLogic:kr/fix-namespace-exports-access
Feb 20, 2026
Merged

BridgeJS: fix namespaced Swift class access in JS codegen#668
krodak merged 1 commit intoswiftwasm:mainfrom
PassiveLogic:kr/fix-namespace-exports-access

Conversation

@krodak
Copy link
Member

@krodak krodak commented Feb 20, 2026

Overview

BridgeJS was generating incorrect JS class references for some swiftHeapObject lifting paths.
This extends #642 (BridgeJS: Use indirect _exports lookup in wrap functions) by applying the same import-side rule to all relevant class lifting paths and by adding namespace-aware _exports resolution.

For namespaced classes, generated code could try _exports['ClassName'] when the class actually lives at _exports.Namespace.Path.ClassName.

In other paths, generated code could also reference class symbols directly in scopes where direct class access is not available. That caused runtime errors like ReferenceError: <Class> is not defined.

Tests

Added couple of test cases that were missing initially, confirmed that these are breaking on current main with same error I'm seeing during BridgeJS integration in other project

@krodak krodak self-assigned this Feb 20, 2026
@krodak krodak force-pushed the kr/fix-namespace-exports-access branch from d1fc97f to 8ebcc22 Compare February 20, 2026 13:45
@krodak krodak merged commit c47beee into swiftwasm:main Feb 20, 2026
12 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