@@ -18,7 +18,7 @@ public class JSFunction: JSObject {
18
18
/// - arguments: Arguments to be passed to this function.
19
19
/// - Returns: The result of this call.
20
20
@discardableResult
21
- public func callAsFunction( this: JSObject , arguments: [ ConvertibleToJSValue ] ) -> JSValue {
21
+ override public func callAsFunction( this: JSObject , arguments: [ ConvertibleToJSValue ] ) -> JSValue {
22
22
invokeNonThrowingJSFunction ( arguments: arguments, this: this) . jsValue
23
23
}
24
24
@@ -27,20 +27,20 @@ public class JSFunction: JSObject {
27
27
/// - arguments: Arguments to be passed to this function.
28
28
/// - Returns: The result of this call.
29
29
@discardableResult
30
- public func callAsFunction( arguments: [ ConvertibleToJSValue ] ) -> JSValue {
30
+ override public func callAsFunction( arguments: [ ConvertibleToJSValue ] ) -> JSValue {
31
31
invokeNonThrowingJSFunction ( arguments: arguments) . jsValue
32
32
}
33
33
34
34
/// A variadic arguments version of `callAsFunction`.
35
35
@discardableResult
36
- public func callAsFunction( this: JSObject , _ arguments: ConvertibleToJSValue ... ) -> JSValue {
37
- self ( this: this, arguments: arguments)
36
+ override public func callAsFunction( this: JSObject , _ arguments: ConvertibleToJSValue ... ) -> JSValue {
37
+ self . callAsFunction ( this: this, arguments: arguments)
38
38
}
39
39
40
40
/// A variadic arguments version of `callAsFunction`.
41
41
@discardableResult
42
- public func callAsFunction( _ arguments: ConvertibleToJSValue ... ) -> JSValue {
43
- self ( arguments: arguments)
42
+ override public func callAsFunction( _ arguments: ConvertibleToJSValue ... ) -> JSValue {
43
+ self . callAsFunction ( arguments: arguments)
44
44
}
45
45
46
46
/// Instantiate an object from this function as a constructor.
@@ -53,7 +53,7 @@ public class JSFunction: JSObject {
53
53
///
54
54
/// - Parameter arguments: Arguments to be passed to this constructor function.
55
55
/// - Returns: A new instance of this constructor.
56
- public func new( arguments: [ ConvertibleToJSValue ] ) -> JSObject {
56
+ override public func new( arguments: [ ConvertibleToJSValue ] ) -> JSObject {
57
57
arguments. withRawJSValues { rawValues in
58
58
rawValues. withUnsafeBufferPointer { bufferPointer in
59
59
JSObject ( id: swjs_call_new ( self . id, bufferPointer. baseAddress!, Int32 ( bufferPointer. count) ) )
@@ -62,7 +62,7 @@ public class JSFunction: JSObject {
62
62
}
63
63
64
64
/// A variadic arguments version of `new`.
65
- public func new( _ arguments: ConvertibleToJSValue ... ) -> JSObject {
65
+ override public func new( _ arguments: ConvertibleToJSValue ... ) -> JSObject {
66
66
new ( arguments: arguments)
67
67
}
68
68
@@ -87,11 +87,11 @@ public class JSFunction: JSObject {
87
87
#endif
88
88
89
89
@discardableResult
90
- public func callAsFunction( arguments: [ JSValue ] ) -> JSValue {
90
+ override public func callAsFunction( arguments: [ JSValue ] ) -> JSValue {
91
91
invokeNonThrowingJSFunction ( arguments: arguments) . jsValue
92
92
}
93
93
94
- public func new( arguments: [ JSValue ] ) -> JSObject {
94
+ override public func new( arguments: [ JSValue ] ) -> JSObject {
95
95
arguments. withRawJSValues { rawValues in
96
96
rawValues. withUnsafeBufferPointer { bufferPointer in
97
97
JSObject ( id: swjs_call_new ( self . id, bufferPointer. baseAddress!, Int32 ( bufferPointer. count) ) )
@@ -107,67 +107,6 @@ public class JSFunction: JSObject {
107
107
override public var jsValue : JSValue {
108
108
. function( self )
109
109
}
110
-
111
- final func invokeNonThrowingJSFunction( arguments: [ JSValue ] ) -> RawJSValue {
112
- arguments. withRawJSValues { invokeNonThrowingJSFunction ( rawValues: $0) }
113
- }
114
-
115
- final func invokeNonThrowingJSFunction( arguments: [ JSValue ] , this: JSObject ) -> RawJSValue {
116
- arguments. withRawJSValues { invokeNonThrowingJSFunction ( rawValues: $0, this: this) }
117
- }
118
-
119
- #if !hasFeature(Embedded)
120
- final func invokeNonThrowingJSFunction( arguments: [ ConvertibleToJSValue ] ) -> RawJSValue {
121
- arguments. withRawJSValues { invokeNonThrowingJSFunction ( rawValues: $0) }
122
- }
123
-
124
- final func invokeNonThrowingJSFunction( arguments: [ ConvertibleToJSValue ] , this: JSObject ) -> RawJSValue {
125
- arguments. withRawJSValues { invokeNonThrowingJSFunction ( rawValues: $0, this: this) }
126
- }
127
- #endif
128
-
129
- final private func invokeNonThrowingJSFunction( rawValues: [ RawJSValue ] ) -> RawJSValue {
130
- rawValues. withUnsafeBufferPointer { [ id] bufferPointer in
131
- let argv = bufferPointer. baseAddress
132
- let argc = bufferPointer. count
133
- var payload1 = JavaScriptPayload1 ( )
134
- var payload2 = JavaScriptPayload2 ( )
135
- let resultBitPattern = swjs_call_function_no_catch (
136
- id,
137
- argv,
138
- Int32 ( argc) ,
139
- & payload1,
140
- & payload2
141
- )
142
- let kindAndFlags = JavaScriptValueKindAndFlags ( bitPattern: resultBitPattern)
143
- assert ( !kindAndFlags. isException)
144
- let result = RawJSValue ( kind: kindAndFlags. kind, payload1: payload1, payload2: payload2)
145
- return result
146
- }
147
- }
148
-
149
- final private func invokeNonThrowingJSFunction( rawValues: [ RawJSValue ] , this: JSObject ) -> RawJSValue {
150
- rawValues. withUnsafeBufferPointer { [ id] bufferPointer in
151
- let argv = bufferPointer. baseAddress
152
- let argc = bufferPointer. count
153
- var payload1 = JavaScriptPayload1 ( )
154
- var payload2 = JavaScriptPayload2 ( )
155
- let resultBitPattern = swjs_call_function_with_this_no_catch (
156
- this. id,
157
- id,
158
- argv,
159
- Int32 ( argc) ,
160
- & payload1,
161
- & payload2
162
- )
163
- let kindAndFlags = JavaScriptValueKindAndFlags ( bitPattern: resultBitPattern)
164
- #if !hasFeature(Embedded)
165
- assert ( !kindAndFlags. isException)
166
- #endif
167
- let result = RawJSValue ( kind: kindAndFlags. kind, payload1: payload1, payload2: payload2)
168
- return result
169
- }
170
- }
171
110
}
172
111
173
112
#if hasFeature(Embedded)
@@ -182,17 +121,17 @@ public class JSFunction: JSObject {
182
121
extension JSFunction {
183
122
184
123
@discardableResult
185
- public func callAsFunction( this: JSObject ) -> JSValue {
124
+ override public func callAsFunction( this: JSObject ) -> JSValue {
186
125
invokeNonThrowingJSFunction ( arguments: [ ] , this: this) . jsValue
187
126
}
188
127
189
128
@discardableResult
190
- public func callAsFunction( this: JSObject , _ arg0: some ConvertibleToJSValue ) -> JSValue {
129
+ override public func callAsFunction( this: JSObject , _ arg0: some ConvertibleToJSValue ) -> JSValue {
191
130
invokeNonThrowingJSFunction ( arguments: [ arg0. jsValue] , this: this) . jsValue
192
131
}
193
132
194
133
@discardableResult
195
- public func callAsFunction(
134
+ override public func callAsFunction(
196
135
this: JSObject ,
197
136
_ arg0: some ConvertibleToJSValue ,
198
137
_ arg1: some ConvertibleToJSValue
@@ -201,7 +140,7 @@ extension JSFunction {
201
140
}
202
141
203
142
@discardableResult
204
- public func callAsFunction(
143
+ override public func callAsFunction(
205
144
this: JSObject ,
206
145
_ arg0: some ConvertibleToJSValue ,
207
146
_ arg1: some ConvertibleToJSValue ,
@@ -211,7 +150,7 @@ extension JSFunction {
211
150
}
212
151
213
152
@discardableResult
214
- public func callAsFunction(
153
+ override public func callAsFunction(
215
154
this: JSObject ,
216
155
_ arg0: some ConvertibleToJSValue ,
217
156
_ arg1: some ConvertibleToJSValue ,
@@ -223,7 +162,7 @@ extension JSFunction {
223
162
}
224
163
225
164
@discardableResult
226
- public func callAsFunction(
165
+ override public func callAsFunction(
227
166
this: JSObject ,
228
167
_ arg0: some ConvertibleToJSValue ,
229
168
_ arg1: some ConvertibleToJSValue ,
@@ -238,7 +177,7 @@ extension JSFunction {
238
177
}
239
178
240
179
@discardableResult
241
- public func callAsFunction(
180
+ override public func callAsFunction(
242
181
this: JSObject ,
243
182
_ arg0: some ConvertibleToJSValue ,
244
183
_ arg1: some ConvertibleToJSValue ,
@@ -254,7 +193,7 @@ extension JSFunction {
254
193
}
255
194
256
195
@discardableResult
257
- public func callAsFunction(
196
+ override public func callAsFunction(
258
197
this: JSObject ,
259
198
_ arg0: some ConvertibleToJSValue ,
260
199
_ arg1: some ConvertibleToJSValue ,
@@ -273,30 +212,30 @@ extension JSFunction {
273
212
}
274
213
275
214
@discardableResult
276
- public func callAsFunction( this: JSObject , arguments: [ JSValue ] ) -> JSValue {
215
+ override public func callAsFunction( this: JSObject , arguments: [ JSValue ] ) -> JSValue {
277
216
invokeNonThrowingJSFunction ( arguments: arguments, this: this) . jsValue
278
217
}
279
218
280
219
@discardableResult
281
- public func callAsFunction( ) -> JSValue {
220
+ override public func callAsFunction( ) -> JSValue {
282
221
invokeNonThrowingJSFunction ( arguments: [ ] ) . jsValue
283
222
}
284
223
285
224
@discardableResult
286
- public func callAsFunction( _ arg0: some ConvertibleToJSValue ) -> JSValue {
225
+ override public func callAsFunction( _ arg0: some ConvertibleToJSValue ) -> JSValue {
287
226
invokeNonThrowingJSFunction ( arguments: [ arg0. jsValue] ) . jsValue
288
227
}
289
228
290
229
@discardableResult
291
- public func callAsFunction(
230
+ override public func callAsFunction(
292
231
_ arg0: some ConvertibleToJSValue ,
293
232
_ arg1: some ConvertibleToJSValue
294
233
) -> JSValue {
295
234
invokeNonThrowingJSFunction ( arguments: [ arg0. jsValue, arg1. jsValue] ) . jsValue
296
235
}
297
236
298
237
@discardableResult
299
- public func callAsFunction(
238
+ override public func callAsFunction(
300
239
_ arg0: some ConvertibleToJSValue ,
301
240
_ arg1: some ConvertibleToJSValue ,
302
241
_ arg2: some ConvertibleToJSValue
@@ -305,7 +244,7 @@ extension JSFunction {
305
244
}
306
245
307
246
@discardableResult
308
- public func callAsFunction(
247
+ override public func callAsFunction(
309
248
_ arg0: some ConvertibleToJSValue ,
310
249
_ arg1: some ConvertibleToJSValue ,
311
250
_ arg2: some ConvertibleToJSValue ,
@@ -315,7 +254,7 @@ extension JSFunction {
315
254
}
316
255
317
256
@discardableResult
318
- public func callAsFunction(
257
+ override public func callAsFunction(
319
258
_ arg0: some ConvertibleToJSValue ,
320
259
_ arg1: some ConvertibleToJSValue ,
321
260
_ arg2: some ConvertibleToJSValue ,
@@ -327,7 +266,7 @@ extension JSFunction {
327
266
}
328
267
329
268
@discardableResult
330
- public func callAsFunction(
269
+ override public func callAsFunction(
331
270
_ arg0: some ConvertibleToJSValue ,
332
271
_ arg1: some ConvertibleToJSValue ,
333
272
_ arg2: some ConvertibleToJSValue ,
@@ -341,7 +280,7 @@ extension JSFunction {
341
280
}
342
281
343
282
@discardableResult
344
- public func callAsFunction(
283
+ override public func callAsFunction(
345
284
_ arg0: some ConvertibleToJSValue ,
346
285
_ arg1: some ConvertibleToJSValue ,
347
286
_ arg2: some ConvertibleToJSValue ,
@@ -355,30 +294,30 @@ extension JSFunction {
355
294
] ) . jsValue
356
295
}
357
296
358
- public func new( ) -> JSObject {
297
+ override public func new( ) -> JSObject {
359
298
new ( arguments: [ ] )
360
299
}
361
300
362
- public func new( _ arg0: some ConvertibleToJSValue ) -> JSObject {
301
+ override public func new( _ arg0: some ConvertibleToJSValue ) -> JSObject {
363
302
new ( arguments: [ arg0. jsValue] )
364
303
}
365
304
366
- public func new(
305
+ override public func new(
367
306
_ arg0: some ConvertibleToJSValue ,
368
307
_ arg1: some ConvertibleToJSValue
369
308
) -> JSObject {
370
309
new ( arguments: [ arg0. jsValue, arg1. jsValue] )
371
310
}
372
311
373
- public func new(
312
+ override public func new(
374
313
_ arg0: some ConvertibleToJSValue ,
375
314
_ arg1: some ConvertibleToJSValue ,
376
315
_ arg2: some ConvertibleToJSValue
377
316
) -> JSObject {
378
317
new ( arguments: [ arg0. jsValue, arg1. jsValue, arg2. jsValue] )
379
318
}
380
319
381
- public func new(
320
+ override public func new(
382
321
_ arg0: some ConvertibleToJSValue ,
383
322
_ arg1: some ConvertibleToJSValue ,
384
323
_ arg2: some ConvertibleToJSValue ,
@@ -387,7 +326,7 @@ extension JSFunction {
387
326
new ( arguments: [ arg0. jsValue, arg1. jsValue, arg2. jsValue, arg3. jsValue] )
388
327
}
389
328
390
- public func new(
329
+ override public func new(
391
330
_ arg0: some ConvertibleToJSValue ,
392
331
_ arg1: some ConvertibleToJSValue ,
393
332
_ arg2: some ConvertibleToJSValue ,
@@ -397,7 +336,7 @@ extension JSFunction {
397
336
new ( arguments: [ arg0. jsValue, arg1. jsValue, arg2. jsValue, arg3. jsValue, arg4. jsValue] )
398
337
}
399
338
400
- public func new(
339
+ override public func new(
401
340
_ arg0: some ConvertibleToJSValue ,
402
341
_ arg1: some ConvertibleToJSValue ,
403
342
_ arg2: some ConvertibleToJSValue ,
@@ -408,7 +347,7 @@ extension JSFunction {
408
347
new ( arguments: [ arg0. jsValue, arg1. jsValue, arg2. jsValue, arg3. jsValue, arg4. jsValue, arg5. jsValue] )
409
348
}
410
349
411
- public func new(
350
+ override public func new(
412
351
_ arg0: some ConvertibleToJSValue ,
413
352
_ arg1: some ConvertibleToJSValue ,
414
353
_ arg2: some ConvertibleToJSValue ,
0 commit comments