@noir-lang/noir_wasm 0.17.0 → 0.18.0-3919619.aztec

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.
@@ -1,14 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {string} level
5
- */
6
- export function init_log_level(level: string): void;
7
- /**
8
- * @returns {any}
9
- */
10
- export function build_info(): any;
11
- /**
12
4
  * @param {Uint8Array} bytes
13
5
  * @returns {any}
14
6
  */
@@ -21,14 +13,22 @@ export function acir_write_bytes(acir: any): Uint8Array;
21
13
  /**
22
14
  * @param {string} entry_point
23
15
  * @param {boolean | undefined} contracts
24
- * @param {string[] | undefined} dependencies
16
+ * @param {DependencyGraph | undefined} dependency_graph
17
+ * @returns {any}
18
+ */
19
+ export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): any;
20
+ /**
21
+ * @param {string} level
22
+ */
23
+ export function init_log_level(level: string): void;
24
+ /**
25
25
  * @returns {any}
26
26
  */
27
- export function compile(entry_point: string, contracts?: boolean, dependencies?: string[]): any;
27
+ export function build_info(): any;
28
28
 
29
29
  export type Diagnostic = {
30
30
  message: string;
31
- file_path: string;
31
+ file: string;
32
32
  secondaries: ReadonlyArray<{
33
33
  message: string;
34
34
  start: number;
@@ -36,19 +36,16 @@ export type Diagnostic = {
36
36
  }>;
37
37
  }
38
38
 
39
- interface CompileError {
39
+ export interface CompileError extends Error {
40
+ message: string;
40
41
  diagnostics: ReadonlyArray<Diagnostic>;
41
42
  }
42
43
 
43
44
 
44
- /**
45
- */
46
- export class CompileError {
47
- free(): void;
48
- /**
49
- */
50
- diagnostics: any;
51
- /**
52
- */
53
- message: string;
45
+
46
+ export type DependencyGraph = {
47
+ root_dependencies: readonly string[];
48
+ library_dependencies: Readonly<Record<string, readonly string[]>>;
54
49
  }
50
+
51
+
@@ -2,7 +2,7 @@ let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
4
  const { read_file } = require(`@noir-lang/source-resolver`);
5
- const { TextEncoder, TextDecoder } = require(`util`);
5
+ const { TextDecoder, TextEncoder } = require(`util`);
6
6
 
7
7
  const heap = new Array(128).fill(undefined);
8
8
 
@@ -24,16 +24,9 @@ function takeObject(idx) {
24
24
  return ret;
25
25
  }
26
26
 
27
- function addHeapObject(obj) {
28
- if (heap_next === heap.length) heap.push(heap.length + 1);
29
- const idx = heap_next;
30
- heap_next = heap[idx];
31
-
32
- heap[idx] = obj;
33
- return idx;
34
- }
27
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
35
28
 
36
- let WASM_VECTOR_LEN = 0;
29
+ cachedTextDecoder.decode();
37
30
 
38
31
  let cachedUint8Memory0 = null;
39
32
 
@@ -44,6 +37,22 @@ function getUint8Memory0() {
44
37
  return cachedUint8Memory0;
45
38
  }
46
39
 
40
+ function getStringFromWasm0(ptr, len) {
41
+ ptr = ptr >>> 0;
42
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
43
+ }
44
+
45
+ function addHeapObject(obj) {
46
+ if (heap_next === heap.length) heap.push(heap.length + 1);
47
+ const idx = heap_next;
48
+ heap_next = heap[idx];
49
+
50
+ heap[idx] = obj;
51
+ return idx;
52
+ }
53
+
54
+ let WASM_VECTOR_LEN = 0;
55
+
47
56
  let cachedTextEncoder = new TextEncoder('utf-8');
48
57
 
49
58
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -110,30 +119,70 @@ function getInt32Memory0() {
110
119
  return cachedInt32Memory0;
111
120
  }
112
121
 
113
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
114
-
115
- cachedTextDecoder.decode();
116
-
117
- function getStringFromWasm0(ptr, len) {
118
- ptr = ptr >>> 0;
119
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
122
+ function debugString(val) {
123
+ // primitive types
124
+ const type = typeof val;
125
+ if (type == 'number' || type == 'boolean' || val == null) {
126
+ return `${val}`;
127
+ }
128
+ if (type == 'string') {
129
+ return `"${val}"`;
130
+ }
131
+ if (type == 'symbol') {
132
+ const description = val.description;
133
+ if (description == null) {
134
+ return 'Symbol';
135
+ } else {
136
+ return `Symbol(${description})`;
137
+ }
138
+ }
139
+ if (type == 'function') {
140
+ const name = val.name;
141
+ if (typeof name == 'string' && name.length > 0) {
142
+ return `Function(${name})`;
143
+ } else {
144
+ return 'Function';
145
+ }
146
+ }
147
+ // objects
148
+ if (Array.isArray(val)) {
149
+ const length = val.length;
150
+ let debug = '[';
151
+ if (length > 0) {
152
+ debug += debugString(val[0]);
153
+ }
154
+ for(let i = 1; i < length; i++) {
155
+ debug += ', ' + debugString(val[i]);
156
+ }
157
+ debug += ']';
158
+ return debug;
159
+ }
160
+ // Test for built-in
161
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
162
+ let className;
163
+ if (builtInMatches.length > 1) {
164
+ className = builtInMatches[1];
165
+ } else {
166
+ // Failed to match the standard '[object ClassName]'
167
+ return toString.call(val);
168
+ }
169
+ if (className == 'Object') {
170
+ // we're a user defined class or Object
171
+ // JSON.stringify avoids problems with cycles, and is generally much
172
+ // easier than looping through ownProperties of `val`.
173
+ try {
174
+ return 'Object(' + JSON.stringify(val) + ')';
175
+ } catch (_) {
176
+ return 'Object';
177
+ }
178
+ }
179
+ // errors
180
+ if (val instanceof Error) {
181
+ return `${val.name}: ${val.message}\n${val.stack}`;
182
+ }
183
+ // TODO we could test for more things here, like `Set`s and `Map`s.
184
+ return className;
120
185
  }
121
- /**
122
- * @param {string} level
123
- */
124
- module.exports.init_log_level = function(level) {
125
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
126
- const len0 = WASM_VECTOR_LEN;
127
- wasm.init_log_level(ptr0, len0);
128
- };
129
-
130
- /**
131
- * @returns {any}
132
- */
133
- module.exports.build_info = function() {
134
- const ret = wasm.build_info();
135
- return takeObject(ret);
136
- };
137
186
 
138
187
  function passArray8ToWasm0(arg, malloc) {
139
188
  const ptr = malloc(arg.length * 1) >>> 0;
@@ -177,15 +226,15 @@ module.exports.acir_write_bytes = function(acir) {
177
226
  /**
178
227
  * @param {string} entry_point
179
228
  * @param {boolean | undefined} contracts
180
- * @param {string[] | undefined} dependencies
229
+ * @param {DependencyGraph | undefined} dependency_graph
181
230
  * @returns {any}
182
231
  */
183
- module.exports.compile = function(entry_point, contracts, dependencies) {
232
+ module.exports.compile = function(entry_point, contracts, dependency_graph) {
184
233
  try {
185
234
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
186
235
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
187
236
  const len0 = WASM_VECTOR_LEN;
188
- wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependencies) ? 0 : addHeapObject(dependencies));
237
+ wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph));
189
238
  var r0 = getInt32Memory0()[retptr / 4 + 0];
190
239
  var r1 = getInt32Memory0()[retptr / 4 + 1];
191
240
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -206,86 +255,37 @@ function handleError(f, args) {
206
255
  }
207
256
  }
208
257
  /**
258
+ * @param {string} level
209
259
  */
210
- class CompileError {
211
-
212
- static __wrap(ptr) {
213
- ptr = ptr >>> 0;
214
- const obj = Object.create(CompileError.prototype);
215
- obj.__wbg_ptr = ptr;
216
-
217
- return obj;
218
- }
219
-
220
- __destroy_into_raw() {
221
- const ptr = this.__wbg_ptr;
222
- this.__wbg_ptr = 0;
223
-
224
- return ptr;
225
- }
226
-
227
- free() {
228
- const ptr = this.__destroy_into_raw();
229
- wasm.__wbg_compileerror_free(ptr);
230
- }
231
- /**
232
- * @returns {string}
233
- */
234
- get message() {
235
- const ret = wasm.__wbg_get_compileerror_message(this.__wbg_ptr);
236
- return takeObject(ret);
237
- }
238
- /**
239
- * @param {string} arg0
240
- */
241
- set message(arg0) {
242
- wasm.__wbg_set_compileerror_message(this.__wbg_ptr, addHeapObject(arg0));
243
- }
244
- /**
245
- * @returns {any}
246
- */
247
- get diagnostics() {
248
- const ret = wasm.__wbg_get_compileerror_diagnostics(this.__wbg_ptr);
249
- return takeObject(ret);
250
- }
251
- /**
252
- * @param {any} arg0
253
- */
254
- set diagnostics(arg0) {
255
- wasm.__wbg_set_compileerror_diagnostics(this.__wbg_ptr, addHeapObject(arg0));
256
- }
257
- }
258
- module.exports.CompileError = CompileError;
260
+ module.exports.init_log_level = function(level) {
261
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
262
+ const len0 = WASM_VECTOR_LEN;
263
+ wasm.init_log_level(ptr0, len0);
264
+ };
259
265
 
260
- module.exports.__wbg_compileerror_new = function(arg0) {
261
- const ret = CompileError.__wrap(arg0);
262
- return addHeapObject(ret);
266
+ /**
267
+ * @returns {any}
268
+ */
269
+ module.exports.build_info = function() {
270
+ const ret = wasm.build_info();
271
+ return takeObject(ret);
263
272
  };
264
273
 
265
274
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
266
275
  takeObject(arg0);
267
276
  };
268
277
 
269
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
270
- const ret = getObject(arg0);
278
+ module.exports.__wbg_constructor_bc58db5a3b38f16c = function(arg0) {
279
+ const ret = new Error(takeObject(arg0));
271
280
  return addHeapObject(ret);
272
281
  };
273
282
 
274
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
275
- const obj = getObject(arg1);
276
- const ret = typeof(obj) === 'string' ? obj : undefined;
277
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
278
- var len1 = WASM_VECTOR_LEN;
279
- getInt32Memory0()[arg0 / 4 + 1] = len1;
280
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
281
- };
282
-
283
283
  module.exports.__wbindgen_is_undefined = function(arg0) {
284
284
  const ret = getObject(arg0) === undefined;
285
285
  return ret;
286
286
  };
287
287
 
288
- module.exports.__wbg_readfile_db7d495e3e198483 = function() { return handleError(function (arg0, arg1, arg2) {
288
+ module.exports.__wbg_readfile_a8c4f775fbe0578e = function() { return handleError(function (arg0, arg1, arg2) {
289
289
  const ret = read_file(getStringFromWasm0(arg1, arg2));
290
290
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
291
291
  const len1 = WASM_VECTOR_LEN;
@@ -347,15 +347,19 @@ module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
347
347
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
348
348
  };
349
349
 
350
- module.exports.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
351
- const ret = getObject(arg0)[arg1 >>> 0];
352
- return addHeapObject(ret);
350
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
351
+ const obj = getObject(arg1);
352
+ const ret = typeof(obj) === 'string' ? obj : undefined;
353
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
354
+ var len1 = WASM_VECTOR_LEN;
355
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
356
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
353
357
  };
354
358
 
355
- module.exports.__wbg_length_820c786973abdd8a = function(arg0) {
356
- const ret = getObject(arg0).length;
359
+ module.exports.__wbg_set_07da13cc24b69217 = function() { return handleError(function (arg0, arg1, arg2) {
360
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
357
361
  return ret;
358
- };
362
+ }, arguments) };
359
363
 
360
364
  module.exports.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
361
365
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
@@ -367,6 +371,14 @@ module.exports.__wbg_stringify_d06ad2addc54d51e = function() { return handleErro
367
371
  return addHeapObject(ret);
368
372
  }, arguments) };
369
373
 
374
+ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
375
+ const ret = debugString(getObject(arg1));
376
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
377
+ const len1 = WASM_VECTOR_LEN;
378
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
379
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
380
+ };
381
+
370
382
  module.exports.__wbindgen_throw = function(arg0, arg1) {
371
383
  throw new Error(getStringFromWasm0(arg0, arg1));
372
384
  };
Binary file
@@ -1,16 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function __wbg_compileerror_free(a: number): void;
5
- export function __wbg_get_compileerror_message(a: number): number;
6
- export function __wbg_set_compileerror_message(a: number, b: number): void;
7
- export function __wbg_get_compileerror_diagnostics(a: number): number;
8
- export function __wbg_set_compileerror_diagnostics(a: number, b: number): void;
9
- export function init_log_level(a: number, b: number): void;
10
- export function build_info(): number;
11
4
  export function acir_read_bytes(a: number, b: number): number;
12
5
  export function acir_write_bytes(a: number, b: number): void;
13
6
  export function compile(a: number, b: number, c: number, d: number, e: number): void;
7
+ export function init_log_level(a: number, b: number): void;
8
+ export function build_info(): number;
14
9
  export function __wbindgen_export_0(a: number): number;
15
10
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
16
11
  export function __wbindgen_add_to_stack_pointer(a: number): number;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "The Noir Team <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.17.0",
6
+ "version": "0.18.0-3919619.aztec",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "main": "./nodejs/noir_wasm.js",
9
9
  "types": "./web/noir_wasm.d.ts",
@@ -31,7 +31,7 @@
31
31
  "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./"
32
32
  },
33
33
  "peerDependencies": {
34
- "@noir-lang/source-resolver": "0.17.0"
34
+ "@noir-lang/source-resolver": "0.18.0-3919619.aztec"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@esm-bundle/chai": "^4.3.4-fix.0",
@@ -1,14 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {string} level
5
- */
6
- export function init_log_level(level: string): void;
7
- /**
8
- * @returns {any}
9
- */
10
- export function build_info(): any;
11
- /**
12
4
  * @param {Uint8Array} bytes
13
5
  * @returns {any}
14
6
  */
@@ -21,14 +13,22 @@ export function acir_write_bytes(acir: any): Uint8Array;
21
13
  /**
22
14
  * @param {string} entry_point
23
15
  * @param {boolean | undefined} contracts
24
- * @param {string[] | undefined} dependencies
16
+ * @param {DependencyGraph | undefined} dependency_graph
17
+ * @returns {any}
18
+ */
19
+ export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): any;
20
+ /**
21
+ * @param {string} level
22
+ */
23
+ export function init_log_level(level: string): void;
24
+ /**
25
25
  * @returns {any}
26
26
  */
27
- export function compile(entry_point: string, contracts?: boolean, dependencies?: string[]): any;
27
+ export function build_info(): any;
28
28
 
29
29
  export type Diagnostic = {
30
30
  message: string;
31
- file_path: string;
31
+ file: string;
32
32
  secondaries: ReadonlyArray<{
33
33
  message: string;
34
34
  start: number;
@@ -36,37 +36,29 @@ export type Diagnostic = {
36
36
  }>;
37
37
  }
38
38
 
39
- interface CompileError {
39
+ export interface CompileError extends Error {
40
+ message: string;
40
41
  diagnostics: ReadonlyArray<Diagnostic>;
41
42
  }
42
43
 
43
44
 
44
- /**
45
- */
46
- export class CompileError {
47
- free(): void;
48
- /**
49
- */
50
- diagnostics: any;
51
- /**
52
- */
53
- message: string;
45
+
46
+ export type DependencyGraph = {
47
+ root_dependencies: readonly string[];
48
+ library_dependencies: Readonly<Record<string, readonly string[]>>;
54
49
  }
55
50
 
51
+
52
+
56
53
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
57
54
 
58
55
  export interface InitOutput {
59
56
  readonly memory: WebAssembly.Memory;
60
- readonly __wbg_compileerror_free: (a: number) => void;
61
- readonly __wbg_get_compileerror_message: (a: number) => number;
62
- readonly __wbg_set_compileerror_message: (a: number, b: number) => void;
63
- readonly __wbg_get_compileerror_diagnostics: (a: number) => number;
64
- readonly __wbg_set_compileerror_diagnostics: (a: number, b: number) => void;
65
- readonly init_log_level: (a: number, b: number) => void;
66
- readonly build_info: () => number;
67
57
  readonly acir_read_bytes: (a: number, b: number) => number;
68
58
  readonly acir_write_bytes: (a: number, b: number) => void;
69
59
  readonly compile: (a: number, b: number, c: number, d: number, e: number) => void;
60
+ readonly init_log_level: (a: number, b: number) => void;
61
+ readonly build_info: () => number;
70
62
  readonly __wbindgen_export_0: (a: number) => number;
71
63
  readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
72
64
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
package/web/noir_wasm.js CHANGED
@@ -22,16 +22,9 @@ function takeObject(idx) {
22
22
  return ret;
23
23
  }
24
24
 
25
- function addHeapObject(obj) {
26
- if (heap_next === heap.length) heap.push(heap.length + 1);
27
- const idx = heap_next;
28
- heap_next = heap[idx];
29
-
30
- heap[idx] = obj;
31
- return idx;
32
- }
25
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
33
26
 
34
- let WASM_VECTOR_LEN = 0;
27
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
35
28
 
36
29
  let cachedUint8Memory0 = null;
37
30
 
@@ -42,6 +35,22 @@ function getUint8Memory0() {
42
35
  return cachedUint8Memory0;
43
36
  }
44
37
 
38
+ function getStringFromWasm0(ptr, len) {
39
+ ptr = ptr >>> 0;
40
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
41
+ }
42
+
43
+ function addHeapObject(obj) {
44
+ if (heap_next === heap.length) heap.push(heap.length + 1);
45
+ const idx = heap_next;
46
+ heap_next = heap[idx];
47
+
48
+ heap[idx] = obj;
49
+ return idx;
50
+ }
51
+
52
+ let WASM_VECTOR_LEN = 0;
53
+
45
54
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
46
55
 
47
56
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -108,29 +117,69 @@ function getInt32Memory0() {
108
117
  return cachedInt32Memory0;
109
118
  }
110
119
 
111
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
112
-
113
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
114
-
115
- function getStringFromWasm0(ptr, len) {
116
- ptr = ptr >>> 0;
117
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
118
- }
119
- /**
120
- * @param {string} level
121
- */
122
- export function init_log_level(level) {
123
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
124
- const len0 = WASM_VECTOR_LEN;
125
- wasm.init_log_level(ptr0, len0);
126
- }
127
-
128
- /**
129
- * @returns {any}
130
- */
131
- export function build_info() {
132
- const ret = wasm.build_info();
133
- return takeObject(ret);
120
+ function debugString(val) {
121
+ // primitive types
122
+ const type = typeof val;
123
+ if (type == 'number' || type == 'boolean' || val == null) {
124
+ return `${val}`;
125
+ }
126
+ if (type == 'string') {
127
+ return `"${val}"`;
128
+ }
129
+ if (type == 'symbol') {
130
+ const description = val.description;
131
+ if (description == null) {
132
+ return 'Symbol';
133
+ } else {
134
+ return `Symbol(${description})`;
135
+ }
136
+ }
137
+ if (type == 'function') {
138
+ const name = val.name;
139
+ if (typeof name == 'string' && name.length > 0) {
140
+ return `Function(${name})`;
141
+ } else {
142
+ return 'Function';
143
+ }
144
+ }
145
+ // objects
146
+ if (Array.isArray(val)) {
147
+ const length = val.length;
148
+ let debug = '[';
149
+ if (length > 0) {
150
+ debug += debugString(val[0]);
151
+ }
152
+ for(let i = 1; i < length; i++) {
153
+ debug += ', ' + debugString(val[i]);
154
+ }
155
+ debug += ']';
156
+ return debug;
157
+ }
158
+ // Test for built-in
159
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
160
+ let className;
161
+ if (builtInMatches.length > 1) {
162
+ className = builtInMatches[1];
163
+ } else {
164
+ // Failed to match the standard '[object ClassName]'
165
+ return toString.call(val);
166
+ }
167
+ if (className == 'Object') {
168
+ // we're a user defined class or Object
169
+ // JSON.stringify avoids problems with cycles, and is generally much
170
+ // easier than looping through ownProperties of `val`.
171
+ try {
172
+ return 'Object(' + JSON.stringify(val) + ')';
173
+ } catch (_) {
174
+ return 'Object';
175
+ }
176
+ }
177
+ // errors
178
+ if (val instanceof Error) {
179
+ return `${val.name}: ${val.message}\n${val.stack}`;
180
+ }
181
+ // TODO we could test for more things here, like `Set`s and `Map`s.
182
+ return className;
134
183
  }
135
184
 
136
185
  function passArray8ToWasm0(arg, malloc) {
@@ -175,15 +224,15 @@ export function acir_write_bytes(acir) {
175
224
  /**
176
225
  * @param {string} entry_point
177
226
  * @param {boolean | undefined} contracts
178
- * @param {string[] | undefined} dependencies
227
+ * @param {DependencyGraph | undefined} dependency_graph
179
228
  * @returns {any}
180
229
  */
181
- export function compile(entry_point, contracts, dependencies) {
230
+ export function compile(entry_point, contracts, dependency_graph) {
182
231
  try {
183
232
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
184
233
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
185
234
  const len0 = WASM_VECTOR_LEN;
186
- wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependencies) ? 0 : addHeapObject(dependencies));
235
+ wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph));
187
236
  var r0 = getInt32Memory0()[retptr / 4 + 0];
188
237
  var r1 = getInt32Memory0()[retptr / 4 + 1];
189
238
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -204,54 +253,20 @@ function handleError(f, args) {
204
253
  }
205
254
  }
206
255
  /**
256
+ * @param {string} level
207
257
  */
208
- export class CompileError {
209
-
210
- static __wrap(ptr) {
211
- ptr = ptr >>> 0;
212
- const obj = Object.create(CompileError.prototype);
213
- obj.__wbg_ptr = ptr;
214
-
215
- return obj;
216
- }
217
-
218
- __destroy_into_raw() {
219
- const ptr = this.__wbg_ptr;
220
- this.__wbg_ptr = 0;
221
-
222
- return ptr;
223
- }
258
+ export function init_log_level(level) {
259
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
260
+ const len0 = WASM_VECTOR_LEN;
261
+ wasm.init_log_level(ptr0, len0);
262
+ }
224
263
 
225
- free() {
226
- const ptr = this.__destroy_into_raw();
227
- wasm.__wbg_compileerror_free(ptr);
228
- }
229
- /**
230
- * @returns {string}
231
- */
232
- get message() {
233
- const ret = wasm.__wbg_get_compileerror_message(this.__wbg_ptr);
234
- return takeObject(ret);
235
- }
236
- /**
237
- * @param {string} arg0
238
- */
239
- set message(arg0) {
240
- wasm.__wbg_set_compileerror_message(this.__wbg_ptr, addHeapObject(arg0));
241
- }
242
- /**
243
- * @returns {any}
244
- */
245
- get diagnostics() {
246
- const ret = wasm.__wbg_get_compileerror_diagnostics(this.__wbg_ptr);
247
- return takeObject(ret);
248
- }
249
- /**
250
- * @param {any} arg0
251
- */
252
- set diagnostics(arg0) {
253
- wasm.__wbg_set_compileerror_diagnostics(this.__wbg_ptr, addHeapObject(arg0));
254
- }
264
+ /**
265
+ * @returns {any}
266
+ */
267
+ export function build_info() {
268
+ const ret = wasm.build_info();
269
+ return takeObject(ret);
255
270
  }
256
271
 
257
272
  async function __wbg_load(module, imports) {
@@ -288,30 +303,18 @@ async function __wbg_load(module, imports) {
288
303
  function __wbg_get_imports() {
289
304
  const imports = {};
290
305
  imports.wbg = {};
291
- imports.wbg.__wbg_compileerror_new = function(arg0) {
292
- const ret = CompileError.__wrap(arg0);
293
- return addHeapObject(ret);
294
- };
295
306
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
296
307
  takeObject(arg0);
297
308
  };
298
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
299
- const ret = getObject(arg0);
309
+ imports.wbg.__wbg_constructor_bc58db5a3b38f16c = function(arg0) {
310
+ const ret = new Error(takeObject(arg0));
300
311
  return addHeapObject(ret);
301
312
  };
302
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
303
- const obj = getObject(arg1);
304
- const ret = typeof(obj) === 'string' ? obj : undefined;
305
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
306
- var len1 = WASM_VECTOR_LEN;
307
- getInt32Memory0()[arg0 / 4 + 1] = len1;
308
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
309
- };
310
313
  imports.wbg.__wbindgen_is_undefined = function(arg0) {
311
314
  const ret = getObject(arg0) === undefined;
312
315
  return ret;
313
316
  };
314
- imports.wbg.__wbg_readfile_db7d495e3e198483 = function() { return handleError(function (arg0, arg1, arg2) {
317
+ imports.wbg.__wbg_readfile_a8c4f775fbe0578e = function() { return handleError(function (arg0, arg1, arg2) {
315
318
  const ret = read_file(getStringFromWasm0(arg1, arg2));
316
319
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
317
320
  const len1 = WASM_VECTOR_LEN;
@@ -362,14 +365,18 @@ function __wbg_get_imports() {
362
365
  imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
363
366
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
364
367
  };
365
- imports.wbg.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
366
- const ret = getObject(arg0)[arg1 >>> 0];
367
- return addHeapObject(ret);
368
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
369
+ const obj = getObject(arg1);
370
+ const ret = typeof(obj) === 'string' ? obj : undefined;
371
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
372
+ var len1 = WASM_VECTOR_LEN;
373
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
374
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
368
375
  };
369
- imports.wbg.__wbg_length_820c786973abdd8a = function(arg0) {
370
- const ret = getObject(arg0).length;
376
+ imports.wbg.__wbg_set_07da13cc24b69217 = function() { return handleError(function (arg0, arg1, arg2) {
377
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
371
378
  return ret;
372
- };
379
+ }, arguments) };
373
380
  imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
374
381
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
375
382
  return addHeapObject(ret);
@@ -378,6 +385,13 @@ function __wbg_get_imports() {
378
385
  const ret = JSON.stringify(getObject(arg0));
379
386
  return addHeapObject(ret);
380
387
  }, arguments) };
388
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
389
+ const ret = debugString(getObject(arg1));
390
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
391
+ const len1 = WASM_VECTOR_LEN;
392
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
393
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
394
+ };
381
395
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
382
396
  throw new Error(getStringFromWasm0(arg0, arg1));
383
397
  };
Binary file
@@ -1,16 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function __wbg_compileerror_free(a: number): void;
5
- export function __wbg_get_compileerror_message(a: number): number;
6
- export function __wbg_set_compileerror_message(a: number, b: number): void;
7
- export function __wbg_get_compileerror_diagnostics(a: number): number;
8
- export function __wbg_set_compileerror_diagnostics(a: number, b: number): void;
9
- export function init_log_level(a: number, b: number): void;
10
- export function build_info(): number;
11
4
  export function acir_read_bytes(a: number, b: number): number;
12
5
  export function acir_write_bytes(a: number, b: number): void;
13
6
  export function compile(a: number, b: number, c: number, d: number, e: number): void;
7
+ export function init_log_level(a: number, b: number): void;
8
+ export function build_info(): number;
14
9
  export function __wbindgen_export_0(a: number): number;
15
10
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
16
11
  export function __wbindgen_add_to_stack_pointer(a: number): number;