Skip to content

Commit 8609706

Browse files
committed
BridgeJS: Fix static property call expression for nested structs and enums
1 parent 84624af commit 8609706

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,15 +560,15 @@ public class ExportSwift {
560560
func callName(for property: ExportedProperty) -> String {
561561
switch self {
562562
case .enumStatic(let enumDef):
563-
return property.callName(prefix: enumDef.swiftCallName)
563+
return "\(enumDef.swiftCallName).\(property.name)"
564564
case .classStatic(let klass):
565565
// property.callName() would use staticContext (the ABI name) as prefix;
566566
// use swiftCallName directly so the emitted expression is valid Swift.
567567
return "\(klass.swiftCallName).\(property.name)"
568568
case .classInstance:
569569
return property.callName()
570570
case .structStatic(let structDef):
571-
return property.callName(prefix: structDef.swiftCallName)
571+
return "\(structDef.swiftCallName).\(property.name)"
572572
}
573573
}
574574
}

Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ClassWithNestedTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public func _bjs_Account_Credentials_init(_ tokenBytes: Int32, _ tokenLength: In
6262
@_cdecl("bjs_Account_Credentials_static_maxLength_get")
6363
public func _bjs_Account_Credentials_static_maxLength_get() -> Int32 {
6464
#if arch(wasm32)
65-
let ret = Account_Credentials.maxLength
65+
let ret = Account.Credentials.maxLength
6666
return ret.bridgeJSLowerReturn()
6767
#else
6868
fatalError("Only available on WebAssembly")

Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StructWithNestedTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public func _bjs_Widget_Bounds_init(_ width: Int32, _ height: Int32) -> Void {
230230
@_cdecl("bjs_Widget_Bounds_static_dimensions_get")
231231
public func _bjs_Widget_Bounds_static_dimensions_get() -> Int32 {
232232
#if arch(wasm32)
233-
let ret = Widget_Bounds.dimensions
233+
let ret = Widget.Bounds.dimensions
234234
return ret.bridgeJSLowerReturn()
235235
#else
236236
fatalError("Only available on WebAssembly")

0 commit comments

Comments
 (0)