-
-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathBridgeJS.ImportTS.swift
More file actions
65 lines (59 loc) · 2.06 KB
/
BridgeJS.ImportTS.swift
File metadata and controls
65 lines (59 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit,
// DO NOT EDIT.
//
// To update this file, just rebuild your project or run
// `swift package bridge-js`.
@_spi(JSObject_id) import JavaScriptKit
#if arch(wasm32)
@_extern(wasm, module: "bjs", name: "make_jsstring")
func _make_jsstring(_ ptr: UnsafePointer<UInt8>?, _ len: Int32) -> Int32
#else
func _make_jsstring(_ ptr: UnsafePointer<UInt8>?, _ len: Int32) -> Int32 {
fatalError("Only available on WebAssembly")
}
#endif
#if arch(wasm32)
@_extern(wasm, module: "bjs", name: "init_memory_with_result")
func _init_memory_with_result(_ ptr: UnsafePointer<UInt8>?, _ len: Int32)
#else
func _init_memory_with_result(_ ptr: UnsafePointer<UInt8>?, _ len: Int32) {
fatalError("Only available on WebAssembly")
}
#endif
func benchmarkHelperNoop() -> Void {
#if arch(wasm32)
@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop")
func bjs_benchmarkHelperNoop() -> Void
#else
func bjs_benchmarkHelperNoop() -> Void {
fatalError("Only available on WebAssembly")
}
#endif
bjs_benchmarkHelperNoop()
}
func benchmarkHelperNoopWithNumber(_ n: Double) -> Void {
#if arch(wasm32)
@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber")
func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void
#else
func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void {
fatalError("Only available on WebAssembly")
}
#endif
bjs_benchmarkHelperNoopWithNumber(n)
}
func benchmarkRunner(_ name: String, _ body: JSObject) -> Void {
#if arch(wasm32)
@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner")
func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void
#else
func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void {
fatalError("Only available on WebAssembly")
}
#endif
var name = name
let nameId = name.withUTF8 { b in
_make_jsstring(b.baseAddress.unsafelyUnwrapped, Int32(b.count))
}
bjs_benchmarkRunner(nameId, Int32(bitPattern: body.id))
}