Skip to content

Commit 3b305b7

Browse files
BridgeJS: Fix JSObject assignment in init for imported TS class
1 parent 328a5b7 commit 3b305b7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Plugins/BridgeJS/Sources/BridgeJSTool/ImportTS.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ struct ImportTS {
237237
preconditionFailure("assignThis can only be called with a jsObject return type")
238238
}
239239
abiReturnType = .i32
240-
body.append("self.this = ret")
240+
body.append("self.this = JSObject(id: UInt32(bitPattern: ret))")
241241
}
242242

243243
func renderImportDecl() -> DeclSyntax {

Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct Greeter {
3434
_make_jsstring(b.baseAddress.unsafelyUnwrapped, Int32(b.count))
3535
}
3636
let ret = bjs_Greeter_init(nameId)
37-
self.this = ret
37+
self.this = JSObject(id: UInt32(bitPattern: ret))
3838
}
3939

4040
func greet() -> String {

0 commit comments

Comments
 (0)