Skip to content

Commit 53c25ed

Browse files
Cleanup overload definition
1 parent 6053186 commit 53c25ed

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

Diff for: src/swift/Sources/JavaScriptKit/JSValueConvertible.swift

+12-15
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,25 @@ extension JSValue {
139139
}
140140

141141

142-
private func withRawJSValues<T>(_ this: [JSValueConvertible], _ body: ([RawJSValue]) -> T) -> T {
143-
func _withRawJSValues<T>(
144-
_ values: [JSValueConvertible], _ index: Int,
145-
_ results: inout [RawJSValue], _ body: ([RawJSValue]) -> T) -> T {
146-
if index == values.count { return body(results) }
147-
return values[index].jsValue().withRawJSValue { (rawValue) -> T in
148-
results.append(rawValue)
149-
return _withRawJSValues(values, index + 1, &results, body)
150-
}
151-
}
152-
var _results = [RawJSValue]()
153-
return _withRawJSValues(this, 0, &_results, body)
154-
}
155142

156143
extension Array where Element == JSValueConvertible {
157144
func withRawJSValues<T>(_ body: ([RawJSValue]) -> T) -> T {
158-
JavaScriptKit.withRawJSValues(self, body)
145+
func _withRawJSValues<T>(
146+
_ values: [JSValueConvertible], _ index: Int,
147+
_ results: inout [RawJSValue], _ body: ([RawJSValue]) -> T) -> T {
148+
if index == values.count { return body(results) }
149+
return values[index].jsValue().withRawJSValue { (rawValue) -> T in
150+
results.append(rawValue)
151+
return _withRawJSValues(values, index + 1, &results, body)
152+
}
153+
}
154+
var _results = [RawJSValue]()
155+
return _withRawJSValues(self, 0, &_results, body)
159156
}
160157
}
161158

162159
extension Array where Element: JSValueConvertible {
163160
func withRawJSValues<T>(_ body: ([RawJSValue]) -> T) -> T {
164-
JavaScriptKit.withRawJSValues(self, body)
161+
Swift.Array<JSValueConvertible>.withRawJSValues(self)(body)
165162
}
166163
}

0 commit comments

Comments
 (0)