@noir-lang/noir_wasm 1.0.0-beta.3-3bc52e4.nightly → 1.0.0-beta.3-826b18a.nightly
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/index_bg.wasm +0 -0
- package/dist/node/main.js +269 -318
- package/dist/node/main.js.map +1 -1
- package/dist/types/build/cjs/index.d.ts +67 -60
- package/dist/types/build/esm/index.d.ts +74 -68
- package/dist/types/src/types/noir_artifact.d.ts +3 -1
- package/dist/web/main.mjs +290 -324
- package/dist/web/main.mjs.map +1 -1
- package/package.json +2 -2
package/dist/node/main.js
CHANGED
|
@@ -7,58 +7,45 @@
|
|
|
7
7
|
\****************************/
|
|
8
8
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
let imports = {};
|
|
11
12
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
12
13
|
let wasm;
|
|
13
14
|
const { TextDecoder, TextEncoder } = __webpack_require__(/*! util */ "util");
|
|
14
15
|
|
|
15
|
-
const heap = new Array(128).fill(undefined);
|
|
16
|
-
|
|
17
|
-
heap.push(undefined, null, true, false);
|
|
18
|
-
|
|
19
|
-
function getObject(idx) { return heap[idx]; }
|
|
20
|
-
|
|
21
|
-
let heap_next = heap.length;
|
|
22
|
-
|
|
23
|
-
function dropObject(idx) {
|
|
24
|
-
if (idx < 132) return;
|
|
25
|
-
heap[idx] = heap_next;
|
|
26
|
-
heap_next = idx;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function takeObject(idx) {
|
|
30
|
-
const ret = getObject(idx);
|
|
31
|
-
dropObject(idx);
|
|
32
|
-
return ret;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
16
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
36
17
|
|
|
37
18
|
cachedTextDecoder.decode();
|
|
38
19
|
|
|
39
|
-
let
|
|
20
|
+
let cachedUint8ArrayMemory0 = null;
|
|
40
21
|
|
|
41
|
-
function
|
|
42
|
-
if (
|
|
43
|
-
|
|
22
|
+
function getUint8ArrayMemory0() {
|
|
23
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
24
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
44
25
|
}
|
|
45
|
-
return
|
|
26
|
+
return cachedUint8ArrayMemory0;
|
|
46
27
|
}
|
|
47
28
|
|
|
48
29
|
function getStringFromWasm0(ptr, len) {
|
|
49
30
|
ptr = ptr >>> 0;
|
|
50
|
-
return cachedTextDecoder.decode(
|
|
31
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
51
32
|
}
|
|
52
33
|
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
heap_next = heap[idx];
|
|
57
|
-
|
|
58
|
-
heap[idx] = obj;
|
|
34
|
+
function addToExternrefTable0(obj) {
|
|
35
|
+
const idx = wasm.__externref_table_alloc();
|
|
36
|
+
wasm.__wbindgen_export_3.set(idx, obj);
|
|
59
37
|
return idx;
|
|
60
38
|
}
|
|
61
39
|
|
|
40
|
+
function handleError(f, args) {
|
|
41
|
+
try {
|
|
42
|
+
return f.apply(this, args);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
const idx = addToExternrefTable0(e);
|
|
45
|
+
wasm.__wbindgen_exn_store(idx);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
62
49
|
let WASM_VECTOR_LEN = 0;
|
|
63
50
|
|
|
64
51
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -80,16 +67,16 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
80
67
|
|
|
81
68
|
if (realloc === undefined) {
|
|
82
69
|
const buf = cachedTextEncoder.encode(arg);
|
|
83
|
-
const ptr = malloc(buf.length) >>> 0;
|
|
84
|
-
|
|
70
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
71
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
85
72
|
WASM_VECTOR_LEN = buf.length;
|
|
86
73
|
return ptr;
|
|
87
74
|
}
|
|
88
75
|
|
|
89
76
|
let len = arg.length;
|
|
90
|
-
let ptr = malloc(len) >>> 0;
|
|
77
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
91
78
|
|
|
92
|
-
const mem =
|
|
79
|
+
const mem = getUint8ArrayMemory0();
|
|
93
80
|
|
|
94
81
|
let offset = 0;
|
|
95
82
|
|
|
@@ -103,28 +90,25 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
103
90
|
if (offset !== 0) {
|
|
104
91
|
arg = arg.slice(offset);
|
|
105
92
|
}
|
|
106
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
107
|
-
const view =
|
|
93
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
94
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
108
95
|
const ret = encodeString(arg, view);
|
|
109
96
|
|
|
110
97
|
offset += ret.written;
|
|
98
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
111
99
|
}
|
|
112
100
|
|
|
113
101
|
WASM_VECTOR_LEN = offset;
|
|
114
102
|
return ptr;
|
|
115
103
|
}
|
|
116
104
|
|
|
117
|
-
|
|
118
|
-
return x === undefined || x === null;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let cachedInt32Memory0 = null;
|
|
105
|
+
let cachedDataViewMemory0 = null;
|
|
122
106
|
|
|
123
|
-
function
|
|
124
|
-
if (
|
|
125
|
-
|
|
107
|
+
function getDataViewMemory0() {
|
|
108
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
109
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
126
110
|
}
|
|
127
|
-
return
|
|
111
|
+
return cachedDataViewMemory0;
|
|
128
112
|
}
|
|
129
113
|
|
|
130
114
|
function debugString(val) {
|
|
@@ -168,7 +152,7 @@ function debugString(val) {
|
|
|
168
152
|
// Test for built-in
|
|
169
153
|
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
170
154
|
let className;
|
|
171
|
-
if (builtInMatches.length > 1) {
|
|
155
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
172
156
|
className = builtInMatches[1];
|
|
173
157
|
} else {
|
|
174
158
|
// Failed to match the standard '[object ClassName]'
|
|
@@ -192,71 +176,64 @@ function debugString(val) {
|
|
|
192
176
|
return className;
|
|
193
177
|
}
|
|
194
178
|
|
|
179
|
+
function isLikeNone(x) {
|
|
180
|
+
return x === undefined || x === null;
|
|
181
|
+
}
|
|
182
|
+
|
|
195
183
|
function _assertClass(instance, klass) {
|
|
196
184
|
if (!(instance instanceof klass)) {
|
|
197
185
|
throw new Error(`expected instance of ${klass.name}`);
|
|
198
186
|
}
|
|
199
|
-
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function takeFromExternrefTable0(idx) {
|
|
190
|
+
const value = wasm.__wbindgen_export_3.get(idx);
|
|
191
|
+
wasm.__externref_table_dealloc(idx);
|
|
192
|
+
return value;
|
|
200
193
|
}
|
|
201
194
|
/**
|
|
202
|
-
* This is a method that exposes the same API as `compile`
|
|
203
|
-
* But uses the Context based APi internally
|
|
204
|
-
* @param {string} entry_point
|
|
205
|
-
* @param {DependencyGraph | undefined} dependency_graph
|
|
206
|
-
* @param {PathToFileSourceMap} file_source_map
|
|
207
|
-
* @returns {ProgramCompileResult}
|
|
208
|
-
*/
|
|
195
|
+
* This is a method that exposes the same API as `compile`
|
|
196
|
+
* But uses the Context based APi internally
|
|
197
|
+
* @param {string} entry_point
|
|
198
|
+
* @param {DependencyGraph | null | undefined} dependency_graph
|
|
199
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
200
|
+
* @returns {ProgramCompileResult}
|
|
201
|
+
*/
|
|
209
202
|
module.exports.compile_program_ = function(entry_point, dependency_graph, file_source_map) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
218
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
219
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
220
|
-
if (r2) {
|
|
221
|
-
throw takeObject(r1);
|
|
222
|
-
}
|
|
223
|
-
return takeObject(r0);
|
|
224
|
-
} finally {
|
|
225
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
203
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
204
|
+
const len0 = WASM_VECTOR_LEN;
|
|
205
|
+
_assertClass(file_source_map, PathToFileSourceMap);
|
|
206
|
+
var ptr1 = file_source_map.__destroy_into_raw();
|
|
207
|
+
const ret = wasm.compile_program_(ptr0, len0, isLikeNone(dependency_graph) ? 0 : addToExternrefTable0(dependency_graph), ptr1);
|
|
208
|
+
if (ret[2]) {
|
|
209
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
226
210
|
}
|
|
211
|
+
return takeFromExternrefTable0(ret[0]);
|
|
227
212
|
};
|
|
228
213
|
|
|
229
214
|
/**
|
|
230
|
-
* This is a method that exposes the same API as `compile`
|
|
231
|
-
* But uses the Context based APi internally
|
|
232
|
-
* @param {string} entry_point
|
|
233
|
-
* @param {DependencyGraph | undefined} dependency_graph
|
|
234
|
-
* @param {PathToFileSourceMap} file_source_map
|
|
235
|
-
* @returns {ContractCompileResult}
|
|
236
|
-
*/
|
|
215
|
+
* This is a method that exposes the same API as `compile`
|
|
216
|
+
* But uses the Context based APi internally
|
|
217
|
+
* @param {string} entry_point
|
|
218
|
+
* @param {DependencyGraph | null | undefined} dependency_graph
|
|
219
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
220
|
+
* @returns {ContractCompileResult}
|
|
221
|
+
*/
|
|
237
222
|
module.exports.compile_contract_ = function(entry_point, dependency_graph, file_source_map) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
246
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
247
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
248
|
-
if (r2) {
|
|
249
|
-
throw takeObject(r1);
|
|
250
|
-
}
|
|
251
|
-
return takeObject(r0);
|
|
252
|
-
} finally {
|
|
253
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
223
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
224
|
+
const len0 = WASM_VECTOR_LEN;
|
|
225
|
+
_assertClass(file_source_map, PathToFileSourceMap);
|
|
226
|
+
var ptr1 = file_source_map.__destroy_into_raw();
|
|
227
|
+
const ret = wasm.compile_contract_(ptr0, len0, isLikeNone(dependency_graph) ? 0 : addToExternrefTable0(dependency_graph), ptr1);
|
|
228
|
+
if (ret[2]) {
|
|
229
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
254
230
|
}
|
|
231
|
+
return takeFromExternrefTable0(ret[0]);
|
|
255
232
|
};
|
|
256
233
|
|
|
257
234
|
/**
|
|
258
|
-
* @param {string} level
|
|
259
|
-
*/
|
|
235
|
+
* @param {string} level
|
|
236
|
+
*/
|
|
260
237
|
module.exports.init_log_level = function(level) {
|
|
261
238
|
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
262
239
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -264,111 +241,85 @@ module.exports.init_log_level = function(level) {
|
|
|
264
241
|
};
|
|
265
242
|
|
|
266
243
|
/**
|
|
267
|
-
* @returns {any}
|
|
268
|
-
*/
|
|
244
|
+
* @returns {any}
|
|
245
|
+
*/
|
|
269
246
|
module.exports.build_info = function() {
|
|
270
247
|
const ret = wasm.build_info();
|
|
271
|
-
return
|
|
248
|
+
return ret;
|
|
272
249
|
};
|
|
273
250
|
|
|
274
251
|
/**
|
|
275
|
-
* @param {string} entry_point
|
|
276
|
-
* @param {DependencyGraph | undefined} dependency_graph
|
|
277
|
-
* @param {PathToFileSourceMap} file_source_map
|
|
278
|
-
* @returns {ProgramCompileResult}
|
|
279
|
-
*/
|
|
252
|
+
* @param {string} entry_point
|
|
253
|
+
* @param {DependencyGraph | null | undefined} dependency_graph
|
|
254
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
255
|
+
* @returns {ProgramCompileResult}
|
|
256
|
+
*/
|
|
280
257
|
module.exports.compile_program = function(entry_point, dependency_graph, file_source_map) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
289
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
290
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
291
|
-
if (r2) {
|
|
292
|
-
throw takeObject(r1);
|
|
293
|
-
}
|
|
294
|
-
return takeObject(r0);
|
|
295
|
-
} finally {
|
|
296
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
258
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
259
|
+
const len0 = WASM_VECTOR_LEN;
|
|
260
|
+
_assertClass(file_source_map, PathToFileSourceMap);
|
|
261
|
+
var ptr1 = file_source_map.__destroy_into_raw();
|
|
262
|
+
const ret = wasm.compile_program(ptr0, len0, isLikeNone(dependency_graph) ? 0 : addToExternrefTable0(dependency_graph), ptr1);
|
|
263
|
+
if (ret[2]) {
|
|
264
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
297
265
|
}
|
|
266
|
+
return takeFromExternrefTable0(ret[0]);
|
|
298
267
|
};
|
|
299
268
|
|
|
300
269
|
/**
|
|
301
|
-
* @param {string} entry_point
|
|
302
|
-
* @param {DependencyGraph | undefined} dependency_graph
|
|
303
|
-
* @param {PathToFileSourceMap} file_source_map
|
|
304
|
-
* @returns {ContractCompileResult}
|
|
305
|
-
*/
|
|
270
|
+
* @param {string} entry_point
|
|
271
|
+
* @param {DependencyGraph | null | undefined} dependency_graph
|
|
272
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
273
|
+
* @returns {ContractCompileResult}
|
|
274
|
+
*/
|
|
306
275
|
module.exports.compile_contract = function(entry_point, dependency_graph, file_source_map) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
315
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
316
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
317
|
-
if (r2) {
|
|
318
|
-
throw takeObject(r1);
|
|
319
|
-
}
|
|
320
|
-
return takeObject(r0);
|
|
321
|
-
} finally {
|
|
322
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
276
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
277
|
+
const len0 = WASM_VECTOR_LEN;
|
|
278
|
+
_assertClass(file_source_map, PathToFileSourceMap);
|
|
279
|
+
var ptr1 = file_source_map.__destroy_into_raw();
|
|
280
|
+
const ret = wasm.compile_contract(ptr0, len0, isLikeNone(dependency_graph) ? 0 : addToExternrefTable0(dependency_graph), ptr1);
|
|
281
|
+
if (ret[2]) {
|
|
282
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
323
283
|
}
|
|
284
|
+
return takeFromExternrefTable0(ret[0]);
|
|
324
285
|
};
|
|
325
286
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
} catch (e) {
|
|
330
|
-
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
331
|
-
}
|
|
332
|
-
}
|
|
287
|
+
const CompilerContextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
288
|
+
? { register: () => {}, unregister: () => {} }
|
|
289
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_compilercontext_free(ptr >>> 0, 1));
|
|
333
290
|
/**
|
|
334
|
-
* This is a wrapper class that is wasm-bindgen compatible
|
|
335
|
-
* We do not use js_name and rename it like CrateId because
|
|
336
|
-
* then the impl block is not picked up in javascript.
|
|
337
|
-
*/
|
|
291
|
+
* This is a wrapper class that is wasm-bindgen compatible
|
|
292
|
+
* We do not use js_name and rename it like CrateId because
|
|
293
|
+
* then the impl block is not picked up in javascript.
|
|
294
|
+
*/
|
|
338
295
|
class CompilerContext {
|
|
339
296
|
|
|
340
|
-
static __wrap(ptr) {
|
|
341
|
-
ptr = ptr >>> 0;
|
|
342
|
-
const obj = Object.create(CompilerContext.prototype);
|
|
343
|
-
obj.__wbg_ptr = ptr;
|
|
344
|
-
|
|
345
|
-
return obj;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
297
|
__destroy_into_raw() {
|
|
349
298
|
const ptr = this.__wbg_ptr;
|
|
350
299
|
this.__wbg_ptr = 0;
|
|
351
|
-
|
|
300
|
+
CompilerContextFinalization.unregister(this);
|
|
352
301
|
return ptr;
|
|
353
302
|
}
|
|
354
303
|
|
|
355
304
|
free() {
|
|
356
305
|
const ptr = this.__destroy_into_raw();
|
|
357
|
-
wasm.__wbg_compilercontext_free(ptr);
|
|
306
|
+
wasm.__wbg_compilercontext_free(ptr, 0);
|
|
358
307
|
}
|
|
359
308
|
/**
|
|
360
|
-
|
|
361
|
-
|
|
309
|
+
* @param {PathToFileSourceMap} source_map
|
|
310
|
+
*/
|
|
362
311
|
constructor(source_map) {
|
|
363
312
|
_assertClass(source_map, PathToFileSourceMap);
|
|
364
313
|
var ptr0 = source_map.__destroy_into_raw();
|
|
365
314
|
const ret = wasm.compilercontext_new(ptr0);
|
|
366
|
-
|
|
315
|
+
this.__wbg_ptr = ret >>> 0;
|
|
316
|
+
CompilerContextFinalization.register(this, this.__wbg_ptr, this);
|
|
317
|
+
return this;
|
|
367
318
|
}
|
|
368
319
|
/**
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
320
|
+
* @param {string} path_to_crate
|
|
321
|
+
* @returns {CrateId}
|
|
322
|
+
*/
|
|
372
323
|
process_root_crate(path_to_crate) {
|
|
373
324
|
const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
374
325
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -376,9 +327,9 @@ class CompilerContext {
|
|
|
376
327
|
return CrateId.__wrap(ret);
|
|
377
328
|
}
|
|
378
329
|
/**
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
330
|
+
* @param {string} path_to_crate
|
|
331
|
+
* @returns {CrateId}
|
|
332
|
+
*/
|
|
382
333
|
process_dependency_crate(path_to_crate) {
|
|
383
334
|
const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
384
335
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -386,128 +337,114 @@ class CompilerContext {
|
|
|
386
337
|
return CrateId.__wrap(ret);
|
|
387
338
|
}
|
|
388
339
|
/**
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
340
|
+
* @param {string} crate_name
|
|
341
|
+
* @param {CrateId} from
|
|
342
|
+
* @param {CrateId} to
|
|
343
|
+
*/
|
|
393
344
|
add_dependency_edge(crate_name, from, to) {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
402
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
403
|
-
if (r1) {
|
|
404
|
-
throw takeObject(r0);
|
|
405
|
-
}
|
|
406
|
-
} finally {
|
|
407
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
345
|
+
const ptr0 = passStringToWasm0(crate_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
346
|
+
const len0 = WASM_VECTOR_LEN;
|
|
347
|
+
_assertClass(from, CrateId);
|
|
348
|
+
_assertClass(to, CrateId);
|
|
349
|
+
const ret = wasm.compilercontext_add_dependency_edge(this.__wbg_ptr, ptr0, len0, from.__wbg_ptr, to.__wbg_ptr);
|
|
350
|
+
if (ret[1]) {
|
|
351
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
408
352
|
}
|
|
409
353
|
}
|
|
410
354
|
/**
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
355
|
+
* @param {number} program_width
|
|
356
|
+
* @returns {ProgramCompileResult}
|
|
357
|
+
*/
|
|
414
358
|
compile_program(program_width) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
420
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
421
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
422
|
-
if (r2) {
|
|
423
|
-
throw takeObject(r1);
|
|
424
|
-
}
|
|
425
|
-
return takeObject(r0);
|
|
426
|
-
} finally {
|
|
427
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
359
|
+
const ptr = this.__destroy_into_raw();
|
|
360
|
+
const ret = wasm.compilercontext_compile_program(ptr, program_width);
|
|
361
|
+
if (ret[2]) {
|
|
362
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
428
363
|
}
|
|
364
|
+
return takeFromExternrefTable0(ret[0]);
|
|
429
365
|
}
|
|
430
366
|
/**
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
367
|
+
* @param {number} program_width
|
|
368
|
+
* @returns {ContractCompileResult}
|
|
369
|
+
*/
|
|
434
370
|
compile_contract(program_width) {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
440
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
441
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
442
|
-
if (r2) {
|
|
443
|
-
throw takeObject(r1);
|
|
444
|
-
}
|
|
445
|
-
return takeObject(r0);
|
|
446
|
-
} finally {
|
|
447
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
371
|
+
const ptr = this.__destroy_into_raw();
|
|
372
|
+
const ret = wasm.compilercontext_compile_contract(ptr, program_width);
|
|
373
|
+
if (ret[2]) {
|
|
374
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
448
375
|
}
|
|
376
|
+
return takeFromExternrefTable0(ret[0]);
|
|
449
377
|
}
|
|
450
378
|
}
|
|
451
379
|
module.exports.CompilerContext = CompilerContext;
|
|
452
|
-
|
|
453
|
-
|
|
380
|
+
|
|
381
|
+
const CrateIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
382
|
+
? { register: () => {}, unregister: () => {} }
|
|
383
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_crateid_free(ptr >>> 0, 1));
|
|
384
|
+
|
|
454
385
|
class CrateId {
|
|
455
386
|
|
|
456
387
|
static __wrap(ptr) {
|
|
457
388
|
ptr = ptr >>> 0;
|
|
458
389
|
const obj = Object.create(CrateId.prototype);
|
|
459
390
|
obj.__wbg_ptr = ptr;
|
|
460
|
-
|
|
391
|
+
CrateIdFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
461
392
|
return obj;
|
|
462
393
|
}
|
|
463
394
|
|
|
464
395
|
__destroy_into_raw() {
|
|
465
396
|
const ptr = this.__wbg_ptr;
|
|
466
397
|
this.__wbg_ptr = 0;
|
|
467
|
-
|
|
398
|
+
CrateIdFinalization.unregister(this);
|
|
468
399
|
return ptr;
|
|
469
400
|
}
|
|
470
401
|
|
|
471
402
|
free() {
|
|
472
403
|
const ptr = this.__destroy_into_raw();
|
|
473
|
-
wasm.__wbg_crateid_free(ptr);
|
|
404
|
+
wasm.__wbg_crateid_free(ptr, 0);
|
|
474
405
|
}
|
|
475
406
|
}
|
|
476
407
|
module.exports.CrateId = CrateId;
|
|
408
|
+
|
|
409
|
+
const PathToFileSourceMapFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
410
|
+
? { register: () => {}, unregister: () => {} }
|
|
411
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pathtofilesourcemap_free(ptr >>> 0, 1));
|
|
477
412
|
/**
|
|
478
|
-
|
|
413
|
+
* This is map contains the paths of all of the files in the entry-point crate and
|
|
414
|
+
* the transitive dependencies of the entry-point crate.
|
|
415
|
+
*
|
|
416
|
+
* This is for all intents and purposes the file system that the compiler will use to resolve/compile
|
|
417
|
+
* files in the crate being compiled and its dependencies.
|
|
418
|
+
*
|
|
419
|
+
* Using a `BTreeMap` to add files to the [FileManager] in a deterministic order,
|
|
420
|
+
* which affects the `FileId` in the `Location`s in the AST on which the `hash` is based.
|
|
421
|
+
* Note that we cannot expect to match the IDs assigned by the `FileManager` used by `nargo`,
|
|
422
|
+
* because there the order is determined by the dependency graph as well as the file name.
|
|
423
|
+
*/
|
|
479
424
|
class PathToFileSourceMap {
|
|
480
425
|
|
|
481
|
-
static __wrap(ptr) {
|
|
482
|
-
ptr = ptr >>> 0;
|
|
483
|
-
const obj = Object.create(PathToFileSourceMap.prototype);
|
|
484
|
-
obj.__wbg_ptr = ptr;
|
|
485
|
-
|
|
486
|
-
return obj;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
426
|
__destroy_into_raw() {
|
|
490
427
|
const ptr = this.__wbg_ptr;
|
|
491
428
|
this.__wbg_ptr = 0;
|
|
492
|
-
|
|
429
|
+
PathToFileSourceMapFinalization.unregister(this);
|
|
493
430
|
return ptr;
|
|
494
431
|
}
|
|
495
432
|
|
|
496
433
|
free() {
|
|
497
434
|
const ptr = this.__destroy_into_raw();
|
|
498
|
-
wasm.__wbg_pathtofilesourcemap_free(ptr);
|
|
435
|
+
wasm.__wbg_pathtofilesourcemap_free(ptr, 0);
|
|
499
436
|
}
|
|
500
|
-
/**
|
|
501
|
-
*/
|
|
502
437
|
constructor() {
|
|
503
438
|
const ret = wasm.pathtofilesourcemap_new();
|
|
504
|
-
|
|
439
|
+
this.__wbg_ptr = ret >>> 0;
|
|
440
|
+
PathToFileSourceMapFinalization.register(this, this.__wbg_ptr, this);
|
|
441
|
+
return this;
|
|
505
442
|
}
|
|
506
443
|
/**
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
444
|
+
* @param {string} path
|
|
445
|
+
* @param {string} source_code
|
|
446
|
+
* @returns {boolean}
|
|
447
|
+
*/
|
|
511
448
|
add_source_code(path, source_code) {
|
|
512
449
|
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
513
450
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -519,39 +456,34 @@ class PathToFileSourceMap {
|
|
|
519
456
|
}
|
|
520
457
|
module.exports.PathToFileSourceMap = PathToFileSourceMap;
|
|
521
458
|
|
|
522
|
-
module.exports.
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
module.exports.__wbg_constructor_e81ab801e8a0ffd1 = function(arg0) {
|
|
527
|
-
const ret = new Error(takeObject(arg0));
|
|
528
|
-
return addHeapObject(ret);
|
|
459
|
+
module.exports.__wbg_constructor_84b51f8183439483 = function() {
|
|
460
|
+
const ret = new Object();
|
|
461
|
+
return ret;
|
|
529
462
|
};
|
|
530
463
|
|
|
531
|
-
module.exports.
|
|
464
|
+
module.exports.__wbg_constructor_a70e1aaea07e80fd = function() {
|
|
532
465
|
const ret = new Object();
|
|
533
|
-
return
|
|
466
|
+
return ret;
|
|
534
467
|
};
|
|
535
468
|
|
|
536
|
-
module.exports.
|
|
537
|
-
const ret =
|
|
469
|
+
module.exports.__wbg_constructor_dcd6c3e173d3b88b = function(arg0) {
|
|
470
|
+
const ret = new Error(arg0);
|
|
538
471
|
return ret;
|
|
539
472
|
};
|
|
540
473
|
|
|
541
|
-
module.exports.
|
|
542
|
-
|
|
543
|
-
return addHeapObject(ret);
|
|
474
|
+
module.exports.__wbg_debug_3cb59063b29f58c1 = function(arg0) {
|
|
475
|
+
console.debug(arg0);
|
|
544
476
|
};
|
|
545
477
|
|
|
546
|
-
module.exports.
|
|
547
|
-
|
|
548
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
549
|
-
const len1 = WASM_VECTOR_LEN;
|
|
550
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
551
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
478
|
+
module.exports.__wbg_debug_e17b51583ca6a632 = function(arg0, arg1, arg2, arg3) {
|
|
479
|
+
console.debug(arg0, arg1, arg2, arg3);
|
|
552
480
|
};
|
|
553
481
|
|
|
554
|
-
module.exports.
|
|
482
|
+
module.exports.__wbg_error_524f506f44df1645 = function(arg0) {
|
|
483
|
+
console.error(arg0);
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
555
487
|
let deferred0_0;
|
|
556
488
|
let deferred0_1;
|
|
557
489
|
try {
|
|
@@ -559,87 +491,104 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
|
559
491
|
deferred0_1 = arg1;
|
|
560
492
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
561
493
|
} finally {
|
|
562
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1);
|
|
494
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
563
495
|
}
|
|
564
496
|
};
|
|
565
497
|
|
|
566
|
-
module.exports.
|
|
567
|
-
|
|
568
|
-
return addHeapObject(ret);
|
|
498
|
+
module.exports.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
|
|
499
|
+
console.error(arg0, arg1, arg2, arg3);
|
|
569
500
|
};
|
|
570
501
|
|
|
571
|
-
module.exports.
|
|
572
|
-
|
|
502
|
+
module.exports.__wbg_getTime_46267b1c24877e30 = function(arg0) {
|
|
503
|
+
const ret = arg0.getTime();
|
|
504
|
+
return ret;
|
|
573
505
|
};
|
|
574
506
|
|
|
575
|
-
module.exports.
|
|
576
|
-
console.
|
|
507
|
+
module.exports.__wbg_info_033d8b8a0838f1d3 = function(arg0, arg1, arg2, arg3) {
|
|
508
|
+
console.info(arg0, arg1, arg2, arg3);
|
|
577
509
|
};
|
|
578
510
|
|
|
579
|
-
module.exports.
|
|
580
|
-
console.
|
|
511
|
+
module.exports.__wbg_info_3daf2e093e091b66 = function(arg0) {
|
|
512
|
+
console.info(arg0);
|
|
581
513
|
};
|
|
582
514
|
|
|
583
|
-
module.exports.
|
|
584
|
-
|
|
515
|
+
module.exports.__wbg_new0_f788a2397c7ca929 = function() {
|
|
516
|
+
const ret = new Date();
|
|
517
|
+
return ret;
|
|
585
518
|
};
|
|
586
519
|
|
|
587
|
-
module.exports.
|
|
588
|
-
|
|
520
|
+
module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
521
|
+
const ret = new Error();
|
|
522
|
+
return ret;
|
|
589
523
|
};
|
|
590
524
|
|
|
591
|
-
module.exports.
|
|
592
|
-
|
|
593
|
-
|
|
525
|
+
module.exports.__wbg_parse_def2e24ef1252aff = function() { return handleError(function (arg0, arg1) {
|
|
526
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
527
|
+
return ret;
|
|
528
|
+
}, arguments) };
|
|
594
529
|
|
|
595
|
-
module.exports.
|
|
596
|
-
|
|
530
|
+
module.exports.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
531
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
532
|
+
return ret;
|
|
533
|
+
}, arguments) };
|
|
534
|
+
|
|
535
|
+
module.exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
536
|
+
const ret = arg1.stack;
|
|
537
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
538
|
+
const len1 = WASM_VECTOR_LEN;
|
|
539
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
540
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
597
541
|
};
|
|
598
542
|
|
|
599
|
-
module.exports.
|
|
600
|
-
|
|
543
|
+
module.exports.__wbg_stringify_f7ed6987935b4a24 = function() { return handleError(function (arg0) {
|
|
544
|
+
const ret = JSON.stringify(arg0);
|
|
545
|
+
return ret;
|
|
546
|
+
}, arguments) };
|
|
547
|
+
|
|
548
|
+
module.exports.__wbg_warn_4ca3906c248c47c4 = function(arg0) {
|
|
549
|
+
console.warn(arg0);
|
|
601
550
|
};
|
|
602
551
|
|
|
603
|
-
module.exports.
|
|
604
|
-
|
|
605
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
606
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
607
|
-
var len1 = WASM_VECTOR_LEN;
|
|
608
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
609
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
552
|
+
module.exports.__wbg_warn_aaf1f4664a035bd6 = function(arg0, arg1, arg2, arg3) {
|
|
553
|
+
console.warn(arg0, arg1, arg2, arg3);
|
|
610
554
|
};
|
|
611
555
|
|
|
612
|
-
module.exports.
|
|
613
|
-
const ret =
|
|
614
|
-
|
|
556
|
+
module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
557
|
+
const ret = debugString(arg1);
|
|
558
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
559
|
+
const len1 = WASM_VECTOR_LEN;
|
|
560
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
561
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
615
562
|
};
|
|
616
563
|
|
|
617
|
-
module.exports.
|
|
618
|
-
const
|
|
619
|
-
|
|
564
|
+
module.exports.__wbindgen_init_externref_table = function() {
|
|
565
|
+
const table = wasm.__wbindgen_export_3;
|
|
566
|
+
const offset = table.grow(4);
|
|
567
|
+
table.set(0, undefined);
|
|
568
|
+
table.set(offset + 0, undefined);
|
|
569
|
+
table.set(offset + 1, null);
|
|
570
|
+
table.set(offset + 2, true);
|
|
571
|
+
table.set(offset + 3, false);
|
|
572
|
+
;
|
|
620
573
|
};
|
|
621
574
|
|
|
622
|
-
module.exports.
|
|
623
|
-
const ret =
|
|
624
|
-
return
|
|
625
|
-
}
|
|
575
|
+
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
576
|
+
const ret = arg0 === undefined;
|
|
577
|
+
return ret;
|
|
578
|
+
};
|
|
626
579
|
|
|
627
|
-
module.exports.
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
|
|
580
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
581
|
+
const obj = arg1;
|
|
582
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
583
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
584
|
+
var len1 = WASM_VECTOR_LEN;
|
|
585
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
586
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
587
|
+
};
|
|
631
588
|
|
|
632
|
-
module.exports.
|
|
633
|
-
const ret =
|
|
589
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
590
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
634
591
|
return ret;
|
|
635
|
-
}, arguments) };
|
|
636
|
-
|
|
637
|
-
module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
638
|
-
const ret = debugString(getObject(arg1));
|
|
639
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
640
|
-
const len1 = WASM_VECTOR_LEN;
|
|
641
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
642
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
643
592
|
};
|
|
644
593
|
|
|
645
594
|
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
@@ -654,6 +603,8 @@ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
|
654
603
|
wasm = wasmInstance.exports;
|
|
655
604
|
module.exports.__wasm = wasm;
|
|
656
605
|
|
|
606
|
+
wasm.__wbindgen_start();
|
|
607
|
+
|
|
657
608
|
|
|
658
609
|
|
|
659
610
|
/***/ }),
|