Commit 57c1fd8
committed
BridgeJS: Fix static property call expression for namespaced classes
Static properties on `@JS(namespace:)` classes used
`property.callName()` to build the Swift call expression. That method
consults `property.staticContext`, which is stored as
`.className(abiName)` (e.g. `__Swift_Foundation_UUID`), and emits
`\(abiName).\(propertyName)`. The ABI-mangled name is not a valid Swift
identifier so the generated thunk failed to compile.
Static methods were unaffected because `renderSingleExportedMethod`
passes `klass.swiftCallName` directly.
Fix `PropertyRenderingContext.callName(for:)` for the `.classStatic`
case to bypass `property.callName()` and build the expression directly
from `klass.swiftCallName`. This preserves the ABI symbol name
(which still comes through `context.className` → `klass.abiName` →
`property.getterAbiName(className:)`) while producing a valid Swift
call expression in the thunk body.
Also remove the now-unnecessary comment from `prelude.mjs` that
described what the test was checking (the assertion itself is
self-explanatory).1 parent 575b2bf commit 57c1fd8
File tree
5 files changed
+8
-6
lines changed- Plugins/BridgeJS
- Sources/BridgeJSCore
- Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests
- Tests
- BridgeJSRuntimeTests/Generated
5 files changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
437 | 441 | | |
438 | 442 | | |
439 | 443 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8617 | 8617 | | |
8618 | 8618 | | |
8619 | 8619 | | |
8620 | | - | |
| 8620 | + | |
8621 | 8621 | | |
8622 | 8622 | | |
8623 | 8623 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
627 | | - | |
628 | | - | |
629 | 627 | | |
630 | 628 | | |
631 | 629 | | |
| |||
0 commit comments