Skip to content

Commit 7df801c

Browse files
./Utilities/format.swift
1 parent 9acbb8c commit 7df801c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,9 @@ struct BridgeJSLink {
491491
// Always add __construct and constructor methods for all classes
492492
var constructorLines: [String] = []
493493
constructorLines.append("static __construct(ptr) {")
494-
constructorLines.append("return new \(klass.name)(ptr, instance.exports.bjs_\(klass.name)_deinit);".indent(count: 4))
494+
constructorLines.append(
495+
"return new \(klass.name)(ptr, instance.exports.bjs_\(klass.name)_deinit);".indent(count: 4)
496+
)
495497
constructorLines.append("}")
496498
constructorLines.append("")
497499
constructorLines.append("constructor(pointer, deinit) {")

Tests/BridgeJSRuntimeTests/ExportAPITests.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@ struct TestError: Error {
7474
g.changeName(name: name)
7575
}
7676

77-
// Test class without @JS init constructor
77+
// Test class without @JS init constructor
7878
@JS class Calculator {
7979
nonisolated(unsafe) static var onDeinit: () -> Void = {}
80-
80+
8181
@JS func square(value: Int) -> Int {
8282
return value * value
8383
}
84-
84+
8585
@JS func add(a: Int, b: Int) -> Int {
8686
return a + b
8787
}
88-
88+
8989
deinit {
9090
Self.onDeinit()
9191
}
@@ -99,22 +99,21 @@ struct TestError: Error {
9999
return calc.add(a: calc.square(value: x), b: y)
100100
}
101101

102-
103102
class ExportAPITests: XCTestCase {
104103
func testAll() {
105104
var hasDeinitGreeter = false
106105
var hasDeinitCalculator = false
107-
106+
108107
Greeter.onDeinit = {
109108
hasDeinitGreeter = true
110109
}
111-
110+
112111
Calculator.onDeinit = {
113112
hasDeinitCalculator = true
114113
}
115-
114+
116115
runJsWorks()
117-
116+
118117
XCTAssertTrue(hasDeinitGreeter, "Greeter (with @JS init) should have been deinitialized")
119118
XCTAssertTrue(hasDeinitCalculator, "Calculator (without @JS init) should have been deinitialized")
120119
}

0 commit comments

Comments
 (0)