1
1
import { red } from "https://deno.land/[email protected] /fmt/colors.ts" ;
2
2
let wasm ;
3
3
4
- let cachedTextDecoder = new TextDecoder ( "utf-8" , {
5
- ignoreBOM : true ,
6
- fatal : true ,
7
- } ) ;
4
+ const heap = new Array ( 32 ) . fill ( undefined ) ;
8
5
9
- cachedTextDecoder . decode ( ) ;
6
+ heap . push ( undefined , null , true , false ) ;
7
+
8
+ function getObject ( idx ) {
9
+ return heap [ idx ] ;
10
+ }
11
+
12
+ let WASM_VECTOR_LEN = 0 ;
10
13
11
14
let cachegetUint8Memory0 = null ;
12
15
function getUint8Memory0 ( ) {
@@ -19,31 +22,6 @@ function getUint8Memory0() {
19
22
return cachegetUint8Memory0 ;
20
23
}
21
24
22
- function getStringFromWasm0 ( ptr , len ) {
23
- return cachedTextDecoder . decode ( getUint8Memory0 ( ) . subarray ( ptr , ptr + len ) ) ;
24
- }
25
-
26
- const heap = new Array ( 32 ) . fill ( undefined ) ;
27
-
28
- heap . push ( undefined , null , true , false ) ;
29
-
30
- let heap_next = heap . length ;
31
-
32
- function addHeapObject ( obj ) {
33
- if ( heap_next === heap . length ) heap . push ( heap . length + 1 ) ;
34
- const idx = heap_next ;
35
- heap_next = heap [ idx ] ;
36
-
37
- heap [ idx ] = obj ;
38
- return idx ;
39
- }
40
-
41
- function getObject ( idx ) {
42
- return heap [ idx ] ;
43
- }
44
-
45
- let WASM_VECTOR_LEN = 0 ;
46
-
47
25
let cachedTextEncoder = new TextEncoder ( "utf-8" ) ;
48
26
49
27
const encodeString =
@@ -108,6 +86,8 @@ function getInt32Memory0() {
108
86
return cachegetInt32Memory0 ;
109
87
}
110
88
89
+ let heap_next = heap . length ;
90
+
111
91
function dropObject ( idx ) {
112
92
if ( idx < 36 ) return ;
113
93
heap [ idx ] = heap_next ;
@@ -119,6 +99,26 @@ function takeObject(idx) {
119
99
dropObject ( idx ) ;
120
100
return ret ;
121
101
}
102
+
103
+ let cachedTextDecoder = new TextDecoder ( "utf-8" , {
104
+ ignoreBOM : true ,
105
+ fatal : true ,
106
+ } ) ;
107
+
108
+ cachedTextDecoder . decode ( ) ;
109
+
110
+ function getStringFromWasm0 ( ptr , len ) {
111
+ return cachedTextDecoder . decode ( getUint8Memory0 ( ) . subarray ( ptr , ptr + len ) ) ;
112
+ }
113
+
114
+ function addHeapObject ( obj ) {
115
+ if ( heap_next === heap . length ) heap . push ( heap . length + 1 ) ;
116
+ const idx = heap_next ;
117
+ heap_next = heap [ idx ] ;
118
+
119
+ heap [ idx ] = obj ;
120
+ return idx ;
121
+ }
122
122
/**
123
123
* @param {string } specifier
124
124
* @param {string } code
@@ -236,10 +236,6 @@ async function init(input) {
236
236
}
237
237
const imports = { } ;
238
238
imports . wbg = { } ;
239
- imports . wbg . __wbindgen_json_parse = function ( arg0 , arg1 ) {
240
- var ret = JSON . parse ( getStringFromWasm0 ( arg0 , arg1 ) ) ;
241
- return addHeapObject ( ret ) ;
242
- } ;
243
239
imports . wbg . __wbindgen_json_serialize = function ( arg0 , arg1 ) {
244
240
const obj = getObject ( arg1 ) ;
245
241
var ret = JSON . stringify ( obj === undefined ? null : obj ) ;
@@ -255,6 +251,10 @@ async function init(input) {
255
251
imports . wbg . __wbindgen_object_drop_ref = function ( arg0 ) {
256
252
takeObject ( arg0 ) ;
257
253
} ;
254
+ imports . wbg . __wbindgen_json_parse = function ( arg0 , arg1 ) {
255
+ var ret = JSON . parse ( getStringFromWasm0 ( arg0 , arg1 ) ) ;
256
+ return addHeapObject ( ret ) ;
257
+ } ;
258
258
imports . wbg . __wbg_new_59cb74e423758ede = function ( ) {
259
259
var ret = new Error ( ) ;
260
260
return addHeapObject ( ret ) ;
0 commit comments