Skip to content

BridgeJS: Fix property codegen using unqualified type name for namespace-nested classes#682

Merged
krodak merged 1 commit intoswiftwasm:mainfrom
PassiveLogic:kr/fix-namespace-property-codegen
Feb 27, 2026
Merged

BridgeJS: Fix property codegen using unqualified type name for namespace-nested classes#682
krodak merged 1 commit intoswiftwasm:mainfrom
PassiveLogic:kr/fix-namespace-property-codegen

Conversation

@krodak
Copy link
Member

@krodak krodak commented Feb 27, 2026

Overview

Property getter/setter thunks for classes nested inside @JS enum namespaces used the bare class name (e.g. Converter) instead of the qualified name (e.g. Utils.Converter) for the _self parameter type. This causes compilation failures when another type with the same name exists at module scope.

Methods, constructors, deinit, and extensions already used swiftCallName (qualified). Only properties were broken.

Fix: Add a swiftCallName computed property to PropertyRenderingContext and use it for the _self parameter in both getter and setter codegen, matching what methods already do.

Before (generated getter):

let ret = Converter.bridgeJSLiftParameter(_self).precision

After:

let ret = Utils.Converter.bridgeJSLiftParameter(_self).precision

Tests: added precision: Int instance property to the Utils.Converter class in both the snapshot test input and the e2e runtime test. All 104 plugin tests and 141 e2e tests pass.

@krodak krodak force-pushed the kr/fix-namespace-property-codegen branch from 4c869e0 to 330a339 Compare February 27, 2026 15:49
@krodak krodak force-pushed the kr/fix-namespace-property-codegen branch from 330a339 to 816325f Compare February 27, 2026 16:17
@krodak krodak merged commit e902160 into swiftwasm:main Feb 27, 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