@kevin-hu/schemer
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "@kevin-hu/schemer", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "schemer_bg.wasm", |
@@ -5,5 +5,5 @@ /* tslint:disable */ | ||
* @param {string} json_str | ||
* @returns {string} | ||
* @returns {string | undefined} | ||
*/ | ||
export function infer(json_str: string): string; | ||
export function infer(json_str: string): string | undefined; | ||
@@ -10,0 +10,0 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; |
@@ -21,17 +21,2 @@ let wasm; | ||
const heap = new Array(128).fill(undefined); | ||
heap.push(undefined, null, true, false); | ||
let heap_next = heap.length; | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
@@ -100,23 +85,7 @@ | ||
} | ||
function getObject(idx) { return heap[idx]; } | ||
function dropObject(idx) { | ||
if (idx < 132) return; | ||
heap[idx] = heap_next; | ||
heap_next = idx; | ||
} | ||
function takeObject(idx) { | ||
const ret = getObject(idx); | ||
dropObject(idx); | ||
return ret; | ||
} | ||
/** | ||
* @param {string} json_str | ||
* @returns {string} | ||
* @returns {string | undefined} | ||
*/ | ||
export function infer(json_str) { | ||
let deferred3_0; | ||
let deferred3_1; | ||
try { | ||
@@ -129,16 +98,10 @@ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
var ptr2 = r0; | ||
var len2 = r1; | ||
if (r3) { | ||
ptr2 = 0; len2 = 0; | ||
throw takeObject(r2); | ||
let v2; | ||
if (r0 !== 0) { | ||
v2 = getStringFromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1, 1); | ||
} | ||
deferred3_0 = ptr2; | ||
deferred3_1 = len2; | ||
return getStringFromWasm0(ptr2, len2); | ||
return v2; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1); | ||
} | ||
@@ -181,6 +144,2 @@ } | ||
imports.wbg = {}; | ||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_throw = function(arg0, arg1) { | ||
@@ -187,0 +146,0 @@ throw new Error(getStringFromWasm0(arg0, arg1)); |
Sorry, the diff of this file is not supported yet
185291
187