@noir-lang/noir_wasm 0.20.0-e3dcc21.nightly → 0.21.0-fa1cf5f.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.
@@ -11,13 +11,15 @@ export function acir_read_bytes(bytes: Uint8Array): any;
11
11
  */
12
12
  export function acir_write_bytes(acir: any): Uint8Array;
13
13
  /**
14
+ * This is a method that exposes the same API as `compile`
15
+ * But uses the Context based APi internally
14
16
  * @param {string} entry_point
15
17
  * @param {boolean | undefined} contracts
16
18
  * @param {DependencyGraph | undefined} dependency_graph
17
19
  * @param {PathToFileSourceMap} file_source_map
18
20
  * @returns {CompileResult}
19
21
  */
20
- export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
22
+ export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
21
23
  /**
22
24
  * @param {string} level
23
25
  */
@@ -26,6 +28,14 @@ export function init_log_level(level: string): void;
26
28
  * @returns {any}
27
29
  */
28
30
  export function build_info(): any;
31
+ /**
32
+ * @param {string} entry_point
33
+ * @param {boolean | undefined} contracts
34
+ * @param {DependencyGraph | undefined} dependency_graph
35
+ * @param {PathToFileSourceMap} file_source_map
36
+ * @returns {CompileResult}
37
+ */
38
+ export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
29
39
 
30
40
  export type Diagnostic = {
31
41
  message: string;
@@ -52,14 +62,12 @@ export type DependencyGraph = {
52
62
  export type CompiledContract = {
53
63
  noir_version: string;
54
64
  name: string;
55
- backend: string;
56
65
  functions: Array<any>;
57
66
  events: Array<any>;
58
67
  };
59
68
 
60
69
  export type CompiledProgram = {
61
70
  noir_version: string;
62
- backend: string;
63
71
  abi: any;
64
72
  bytecode: string;
65
73
  }
@@ -82,6 +90,49 @@ export type CompileResult = (
82
90
  );
83
91
 
84
92
 
93
+ /**
94
+ * This is a wrapper class that is wasm-bindgen compatible
95
+ * We do not use js_name and rename it like CrateId because
96
+ * then the impl block is not picked up in javascript.
97
+ */
98
+ export class CompilerContext {
99
+ free(): void;
100
+ /**
101
+ * @param {PathToFileSourceMap} source_map
102
+ */
103
+ constructor(source_map: PathToFileSourceMap);
104
+ /**
105
+ * @param {string} path_to_crate
106
+ * @returns {CrateId}
107
+ */
108
+ process_root_crate(path_to_crate: string): CrateId;
109
+ /**
110
+ * @param {string} path_to_crate
111
+ * @returns {CrateId}
112
+ */
113
+ process_dependency_crate(path_to_crate: string): CrateId;
114
+ /**
115
+ * @param {string} crate_name
116
+ * @param {CrateId} from
117
+ * @param {CrateId} to
118
+ */
119
+ add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
120
+ /**
121
+ * @param {number} program_width
122
+ * @returns {CompileResult}
123
+ */
124
+ compile_program(program_width: number): CompileResult;
125
+ /**
126
+ * @param {number} program_width
127
+ * @returns {CompileResult}
128
+ */
129
+ compile_contract(program_width: number): CompileResult;
130
+ }
131
+ /**
132
+ */
133
+ export class CrateId {
134
+ free(): void;
135
+ }
85
136
  /**
86
137
  */
87
138
  export class PathToFileSourceMap {
@@ -229,20 +229,22 @@ function _assertClass(instance, klass) {
229
229
  return instance.ptr;
230
230
  }
231
231
  /**
232
+ * This is a method that exposes the same API as `compile`
233
+ * But uses the Context based APi internally
232
234
  * @param {string} entry_point
233
235
  * @param {boolean | undefined} contracts
234
236
  * @param {DependencyGraph | undefined} dependency_graph
235
237
  * @param {PathToFileSourceMap} file_source_map
236
238
  * @returns {CompileResult}
237
239
  */
238
- module.exports.compile = function(entry_point, contracts, dependency_graph, file_source_map) {
240
+ module.exports.compile_ = function(entry_point, contracts, dependency_graph, file_source_map) {
239
241
  try {
240
242
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
241
243
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
242
244
  const len0 = WASM_VECTOR_LEN;
243
245
  _assertClass(file_source_map, PathToFileSourceMap);
244
246
  var ptr1 = file_source_map.__destroy_into_raw();
245
- wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
247
+ wasm.compile_(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
246
248
  var r0 = getInt32Memory0()[retptr / 4 + 0];
247
249
  var r1 = getInt32Memory0()[retptr / 4 + 1];
248
250
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -272,6 +274,33 @@ module.exports.build_info = function() {
272
274
  return takeObject(ret);
273
275
  };
274
276
 
277
+ /**
278
+ * @param {string} entry_point
279
+ * @param {boolean | undefined} contracts
280
+ * @param {DependencyGraph | undefined} dependency_graph
281
+ * @param {PathToFileSourceMap} file_source_map
282
+ * @returns {CompileResult}
283
+ */
284
+ module.exports.compile = function(entry_point, contracts, dependency_graph, file_source_map) {
285
+ try {
286
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
287
+ const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
288
+ const len0 = WASM_VECTOR_LEN;
289
+ _assertClass(file_source_map, PathToFileSourceMap);
290
+ var ptr1 = file_source_map.__destroy_into_raw();
291
+ wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
292
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
293
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
294
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
295
+ if (r2) {
296
+ throw takeObject(r1);
297
+ }
298
+ return takeObject(r0);
299
+ } finally {
300
+ wasm.__wbindgen_add_to_stack_pointer(16);
301
+ }
302
+ };
303
+
275
304
  function handleError(f, args) {
276
305
  try {
277
306
  return f.apply(this, args);
@@ -280,6 +309,140 @@ function handleError(f, args) {
280
309
  }
281
310
  }
282
311
  /**
312
+ * This is a wrapper class that is wasm-bindgen compatible
313
+ * We do not use js_name and rename it like CrateId because
314
+ * then the impl block is not picked up in javascript.
315
+ */
316
+ class CompilerContext {
317
+
318
+ static __wrap(ptr) {
319
+ ptr = ptr >>> 0;
320
+ const obj = Object.create(CompilerContext.prototype);
321
+ obj.__wbg_ptr = ptr;
322
+
323
+ return obj;
324
+ }
325
+
326
+ __destroy_into_raw() {
327
+ const ptr = this.__wbg_ptr;
328
+ this.__wbg_ptr = 0;
329
+
330
+ return ptr;
331
+ }
332
+
333
+ free() {
334
+ const ptr = this.__destroy_into_raw();
335
+ wasm.__wbg_compilercontext_free(ptr);
336
+ }
337
+ /**
338
+ * @param {PathToFileSourceMap} source_map
339
+ */
340
+ constructor(source_map) {
341
+ _assertClass(source_map, PathToFileSourceMap);
342
+ var ptr0 = source_map.__destroy_into_raw();
343
+ const ret = wasm.compilercontext_new(ptr0);
344
+ return CompilerContext.__wrap(ret);
345
+ }
346
+ /**
347
+ * @param {string} path_to_crate
348
+ * @returns {CrateId}
349
+ */
350
+ process_root_crate(path_to_crate) {
351
+ const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
352
+ const len0 = WASM_VECTOR_LEN;
353
+ const ret = wasm.compilercontext_process_root_crate(this.__wbg_ptr, ptr0, len0);
354
+ return CrateId.__wrap(ret);
355
+ }
356
+ /**
357
+ * @param {string} path_to_crate
358
+ * @returns {CrateId}
359
+ */
360
+ process_dependency_crate(path_to_crate) {
361
+ const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
362
+ const len0 = WASM_VECTOR_LEN;
363
+ const ret = wasm.compilercontext_process_dependency_crate(this.__wbg_ptr, ptr0, len0);
364
+ return CrateId.__wrap(ret);
365
+ }
366
+ /**
367
+ * @param {string} crate_name
368
+ * @param {CrateId} from
369
+ * @param {CrateId} to
370
+ */
371
+ add_dependency_edge(crate_name, from, to) {
372
+ const ptr0 = passStringToWasm0(crate_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
373
+ const len0 = WASM_VECTOR_LEN;
374
+ _assertClass(from, CrateId);
375
+ _assertClass(to, CrateId);
376
+ wasm.compilercontext_add_dependency_edge(this.__wbg_ptr, ptr0, len0, from.__wbg_ptr, to.__wbg_ptr);
377
+ }
378
+ /**
379
+ * @param {number} program_width
380
+ * @returns {CompileResult}
381
+ */
382
+ compile_program(program_width) {
383
+ try {
384
+ const ptr = this.__destroy_into_raw();
385
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
386
+ wasm.compilercontext_compile_program(retptr, ptr, program_width);
387
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
388
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
389
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
390
+ if (r2) {
391
+ throw takeObject(r1);
392
+ }
393
+ return takeObject(r0);
394
+ } finally {
395
+ wasm.__wbindgen_add_to_stack_pointer(16);
396
+ }
397
+ }
398
+ /**
399
+ * @param {number} program_width
400
+ * @returns {CompileResult}
401
+ */
402
+ compile_contract(program_width) {
403
+ try {
404
+ const ptr = this.__destroy_into_raw();
405
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
406
+ wasm.compilercontext_compile_contract(retptr, ptr, program_width);
407
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
408
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
409
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
410
+ if (r2) {
411
+ throw takeObject(r1);
412
+ }
413
+ return takeObject(r0);
414
+ } finally {
415
+ wasm.__wbindgen_add_to_stack_pointer(16);
416
+ }
417
+ }
418
+ }
419
+ module.exports.CompilerContext = CompilerContext;
420
+ /**
421
+ */
422
+ class CrateId {
423
+
424
+ static __wrap(ptr) {
425
+ ptr = ptr >>> 0;
426
+ const obj = Object.create(CrateId.prototype);
427
+ obj.__wbg_ptr = ptr;
428
+
429
+ return obj;
430
+ }
431
+
432
+ __destroy_into_raw() {
433
+ const ptr = this.__wbg_ptr;
434
+ this.__wbg_ptr = 0;
435
+
436
+ return ptr;
437
+ }
438
+
439
+ free() {
440
+ const ptr = this.__destroy_into_raw();
441
+ wasm.__wbg_crateid_free(ptr);
442
+ }
443
+ }
444
+ module.exports.CrateId = CrateId;
445
+ /**
283
446
  */
284
447
  class PathToFileSourceMap {
285
448
 
@@ -328,7 +491,7 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
328
491
  takeObject(arg0);
329
492
  };
330
493
 
331
- module.exports.__wbg_constructor_2f52aa89ce97ba46 = function(arg0) {
494
+ module.exports.__wbg_constructor_35233efb35960b52 = function(arg0) {
332
495
  const ret = new Error(takeObject(arg0));
333
496
  return addHeapObject(ret);
334
497
  };
@@ -338,7 +501,7 @@ module.exports.__wbindgen_is_undefined = function(arg0) {
338
501
  return ret;
339
502
  };
340
503
 
341
- module.exports.__wbg_constructor_1292ee4141d8f79d = function() {
504
+ module.exports.__wbg_constructor_0fbcf25c6da50731 = function() {
342
505
  const ret = new Object();
343
506
  return addHeapObject(ret);
344
507
  };
Binary file
@@ -3,12 +3,21 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function acir_read_bytes(a: number, b: number): number;
5
5
  export function acir_write_bytes(a: number, b: number): void;
6
+ export function __wbg_compilercontext_free(a: number): void;
7
+ export function __wbg_crateid_free(a: number): void;
8
+ export function compilercontext_new(a: number): number;
9
+ export function compilercontext_process_root_crate(a: number, b: number, c: number): number;
10
+ export function compilercontext_process_dependency_crate(a: number, b: number, c: number): number;
11
+ export function compilercontext_add_dependency_edge(a: number, b: number, c: number, d: number, e: number): void;
12
+ export function compilercontext_compile_program(a: number, b: number, c: number): void;
13
+ export function compilercontext_compile_contract(a: number, b: number, c: number): void;
14
+ export function compile_(a: number, b: number, c: number, d: number, e: number, f: number): void;
15
+ export function init_log_level(a: number, b: number): void;
16
+ export function build_info(): number;
6
17
  export function __wbg_pathtofilesourcemap_free(a: number): void;
7
18
  export function pathtofilesourcemap_new(): number;
8
19
  export function pathtofilesourcemap_add_source_code(a: number, b: number, c: number, d: number, e: number): number;
9
20
  export function compile(a: number, b: number, c: number, d: number, e: number, f: number): void;
10
- export function init_log_level(a: number, b: number): void;
11
- export function build_info(): number;
12
21
  export function __wbindgen_export_0(a: number): number;
13
22
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
14
23
  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.20.0-e3dcc21.nightly",
6
+ "version": "0.21.0-fa1cf5f.nightly",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "main": "./nodejs/noir_wasm.js",
9
9
  "types": "./web/noir_wasm.d.ts",
@@ -30,9 +30,6 @@
30
30
  "build:nix": "nix build -L .#noir_wasm",
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
- "peerDependencies": {
34
- "@noir-lang/source-resolver": "0.20.0-e3dcc21.nightly"
35
- },
36
33
  "devDependencies": {
37
34
  "@esm-bundle/chai": "^4.3.4-fix.0",
38
35
  "@web/dev-server-esbuild": "^0.3.6",
@@ -11,13 +11,15 @@ export function acir_read_bytes(bytes: Uint8Array): any;
11
11
  */
12
12
  export function acir_write_bytes(acir: any): Uint8Array;
13
13
  /**
14
+ * This is a method that exposes the same API as `compile`
15
+ * But uses the Context based APi internally
14
16
  * @param {string} entry_point
15
17
  * @param {boolean | undefined} contracts
16
18
  * @param {DependencyGraph | undefined} dependency_graph
17
19
  * @param {PathToFileSourceMap} file_source_map
18
20
  * @returns {CompileResult}
19
21
  */
20
- export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
22
+ export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
21
23
  /**
22
24
  * @param {string} level
23
25
  */
@@ -26,6 +28,14 @@ export function init_log_level(level: string): void;
26
28
  * @returns {any}
27
29
  */
28
30
  export function build_info(): any;
31
+ /**
32
+ * @param {string} entry_point
33
+ * @param {boolean | undefined} contracts
34
+ * @param {DependencyGraph | undefined} dependency_graph
35
+ * @param {PathToFileSourceMap} file_source_map
36
+ * @returns {CompileResult}
37
+ */
38
+ export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
29
39
 
30
40
  export type Diagnostic = {
31
41
  message: string;
@@ -52,14 +62,12 @@ export type DependencyGraph = {
52
62
  export type CompiledContract = {
53
63
  noir_version: string;
54
64
  name: string;
55
- backend: string;
56
65
  functions: Array<any>;
57
66
  events: Array<any>;
58
67
  };
59
68
 
60
69
  export type CompiledProgram = {
61
70
  noir_version: string;
62
- backend: string;
63
71
  abi: any;
64
72
  bytecode: string;
65
73
  }
@@ -82,6 +90,49 @@ export type CompileResult = (
82
90
  );
83
91
 
84
92
 
93
+ /**
94
+ * This is a wrapper class that is wasm-bindgen compatible
95
+ * We do not use js_name and rename it like CrateId because
96
+ * then the impl block is not picked up in javascript.
97
+ */
98
+ export class CompilerContext {
99
+ free(): void;
100
+ /**
101
+ * @param {PathToFileSourceMap} source_map
102
+ */
103
+ constructor(source_map: PathToFileSourceMap);
104
+ /**
105
+ * @param {string} path_to_crate
106
+ * @returns {CrateId}
107
+ */
108
+ process_root_crate(path_to_crate: string): CrateId;
109
+ /**
110
+ * @param {string} path_to_crate
111
+ * @returns {CrateId}
112
+ */
113
+ process_dependency_crate(path_to_crate: string): CrateId;
114
+ /**
115
+ * @param {string} crate_name
116
+ * @param {CrateId} from
117
+ * @param {CrateId} to
118
+ */
119
+ add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
120
+ /**
121
+ * @param {number} program_width
122
+ * @returns {CompileResult}
123
+ */
124
+ compile_program(program_width: number): CompileResult;
125
+ /**
126
+ * @param {number} program_width
127
+ * @returns {CompileResult}
128
+ */
129
+ compile_contract(program_width: number): CompileResult;
130
+ }
131
+ /**
132
+ */
133
+ export class CrateId {
134
+ free(): void;
135
+ }
85
136
  /**
86
137
  */
87
138
  export class PathToFileSourceMap {
@@ -103,12 +154,21 @@ export interface InitOutput {
103
154
  readonly memory: WebAssembly.Memory;
104
155
  readonly acir_read_bytes: (a: number, b: number) => number;
105
156
  readonly acir_write_bytes: (a: number, b: number) => void;
157
+ readonly __wbg_compilercontext_free: (a: number) => void;
158
+ readonly __wbg_crateid_free: (a: number) => void;
159
+ readonly compilercontext_new: (a: number) => number;
160
+ readonly compilercontext_process_root_crate: (a: number, b: number, c: number) => number;
161
+ readonly compilercontext_process_dependency_crate: (a: number, b: number, c: number) => number;
162
+ readonly compilercontext_add_dependency_edge: (a: number, b: number, c: number, d: number, e: number) => void;
163
+ readonly compilercontext_compile_program: (a: number, b: number, c: number) => void;
164
+ readonly compilercontext_compile_contract: (a: number, b: number, c: number) => void;
165
+ readonly compile_: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
166
+ readonly init_log_level: (a: number, b: number) => void;
167
+ readonly build_info: () => number;
106
168
  readonly __wbg_pathtofilesourcemap_free: (a: number) => void;
107
169
  readonly pathtofilesourcemap_new: () => number;
108
170
  readonly pathtofilesourcemap_add_source_code: (a: number, b: number, c: number, d: number, e: number) => number;
109
171
  readonly compile: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
110
- readonly init_log_level: (a: number, b: number) => void;
111
- readonly build_info: () => number;
112
172
  readonly __wbindgen_export_0: (a: number) => number;
113
173
  readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
114
174
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
package/web/noir_wasm.js CHANGED
@@ -226,20 +226,22 @@ function _assertClass(instance, klass) {
226
226
  return instance.ptr;
227
227
  }
228
228
  /**
229
+ * This is a method that exposes the same API as `compile`
230
+ * But uses the Context based APi internally
229
231
  * @param {string} entry_point
230
232
  * @param {boolean | undefined} contracts
231
233
  * @param {DependencyGraph | undefined} dependency_graph
232
234
  * @param {PathToFileSourceMap} file_source_map
233
235
  * @returns {CompileResult}
234
236
  */
235
- export function compile(entry_point, contracts, dependency_graph, file_source_map) {
237
+ export function compile_(entry_point, contracts, dependency_graph, file_source_map) {
236
238
  try {
237
239
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
238
240
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
239
241
  const len0 = WASM_VECTOR_LEN;
240
242
  _assertClass(file_source_map, PathToFileSourceMap);
241
243
  var ptr1 = file_source_map.__destroy_into_raw();
242
- wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
244
+ wasm.compile_(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
243
245
  var r0 = getInt32Memory0()[retptr / 4 + 0];
244
246
  var r1 = getInt32Memory0()[retptr / 4 + 1];
245
247
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -269,6 +271,33 @@ export function build_info() {
269
271
  return takeObject(ret);
270
272
  }
271
273
 
274
+ /**
275
+ * @param {string} entry_point
276
+ * @param {boolean | undefined} contracts
277
+ * @param {DependencyGraph | undefined} dependency_graph
278
+ * @param {PathToFileSourceMap} file_source_map
279
+ * @returns {CompileResult}
280
+ */
281
+ export function compile(entry_point, contracts, dependency_graph, file_source_map) {
282
+ try {
283
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
284
+ const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
285
+ const len0 = WASM_VECTOR_LEN;
286
+ _assertClass(file_source_map, PathToFileSourceMap);
287
+ var ptr1 = file_source_map.__destroy_into_raw();
288
+ wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
289
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
290
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
291
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
292
+ if (r2) {
293
+ throw takeObject(r1);
294
+ }
295
+ return takeObject(r0);
296
+ } finally {
297
+ wasm.__wbindgen_add_to_stack_pointer(16);
298
+ }
299
+ }
300
+
272
301
  function handleError(f, args) {
273
302
  try {
274
303
  return f.apply(this, args);
@@ -277,6 +306,138 @@ function handleError(f, args) {
277
306
  }
278
307
  }
279
308
  /**
309
+ * This is a wrapper class that is wasm-bindgen compatible
310
+ * We do not use js_name and rename it like CrateId because
311
+ * then the impl block is not picked up in javascript.
312
+ */
313
+ export class CompilerContext {
314
+
315
+ static __wrap(ptr) {
316
+ ptr = ptr >>> 0;
317
+ const obj = Object.create(CompilerContext.prototype);
318
+ obj.__wbg_ptr = ptr;
319
+
320
+ return obj;
321
+ }
322
+
323
+ __destroy_into_raw() {
324
+ const ptr = this.__wbg_ptr;
325
+ this.__wbg_ptr = 0;
326
+
327
+ return ptr;
328
+ }
329
+
330
+ free() {
331
+ const ptr = this.__destroy_into_raw();
332
+ wasm.__wbg_compilercontext_free(ptr);
333
+ }
334
+ /**
335
+ * @param {PathToFileSourceMap} source_map
336
+ */
337
+ constructor(source_map) {
338
+ _assertClass(source_map, PathToFileSourceMap);
339
+ var ptr0 = source_map.__destroy_into_raw();
340
+ const ret = wasm.compilercontext_new(ptr0);
341
+ return CompilerContext.__wrap(ret);
342
+ }
343
+ /**
344
+ * @param {string} path_to_crate
345
+ * @returns {CrateId}
346
+ */
347
+ process_root_crate(path_to_crate) {
348
+ const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
349
+ const len0 = WASM_VECTOR_LEN;
350
+ const ret = wasm.compilercontext_process_root_crate(this.__wbg_ptr, ptr0, len0);
351
+ return CrateId.__wrap(ret);
352
+ }
353
+ /**
354
+ * @param {string} path_to_crate
355
+ * @returns {CrateId}
356
+ */
357
+ process_dependency_crate(path_to_crate) {
358
+ const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
359
+ const len0 = WASM_VECTOR_LEN;
360
+ const ret = wasm.compilercontext_process_dependency_crate(this.__wbg_ptr, ptr0, len0);
361
+ return CrateId.__wrap(ret);
362
+ }
363
+ /**
364
+ * @param {string} crate_name
365
+ * @param {CrateId} from
366
+ * @param {CrateId} to
367
+ */
368
+ add_dependency_edge(crate_name, from, to) {
369
+ const ptr0 = passStringToWasm0(crate_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
370
+ const len0 = WASM_VECTOR_LEN;
371
+ _assertClass(from, CrateId);
372
+ _assertClass(to, CrateId);
373
+ wasm.compilercontext_add_dependency_edge(this.__wbg_ptr, ptr0, len0, from.__wbg_ptr, to.__wbg_ptr);
374
+ }
375
+ /**
376
+ * @param {number} program_width
377
+ * @returns {CompileResult}
378
+ */
379
+ compile_program(program_width) {
380
+ try {
381
+ const ptr = this.__destroy_into_raw();
382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ wasm.compilercontext_compile_program(retptr, ptr, program_width);
384
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
385
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
386
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
387
+ if (r2) {
388
+ throw takeObject(r1);
389
+ }
390
+ return takeObject(r0);
391
+ } finally {
392
+ wasm.__wbindgen_add_to_stack_pointer(16);
393
+ }
394
+ }
395
+ /**
396
+ * @param {number} program_width
397
+ * @returns {CompileResult}
398
+ */
399
+ compile_contract(program_width) {
400
+ try {
401
+ const ptr = this.__destroy_into_raw();
402
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
403
+ wasm.compilercontext_compile_contract(retptr, ptr, program_width);
404
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
405
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
406
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
407
+ if (r2) {
408
+ throw takeObject(r1);
409
+ }
410
+ return takeObject(r0);
411
+ } finally {
412
+ wasm.__wbindgen_add_to_stack_pointer(16);
413
+ }
414
+ }
415
+ }
416
+ /**
417
+ */
418
+ export class CrateId {
419
+
420
+ static __wrap(ptr) {
421
+ ptr = ptr >>> 0;
422
+ const obj = Object.create(CrateId.prototype);
423
+ obj.__wbg_ptr = ptr;
424
+
425
+ return obj;
426
+ }
427
+
428
+ __destroy_into_raw() {
429
+ const ptr = this.__wbg_ptr;
430
+ this.__wbg_ptr = 0;
431
+
432
+ return ptr;
433
+ }
434
+
435
+ free() {
436
+ const ptr = this.__destroy_into_raw();
437
+ wasm.__wbg_crateid_free(ptr);
438
+ }
439
+ }
440
+ /**
280
441
  */
281
442
  export class PathToFileSourceMap {
282
443
 
@@ -357,7 +518,7 @@ function __wbg_get_imports() {
357
518
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
358
519
  takeObject(arg0);
359
520
  };
360
- imports.wbg.__wbg_constructor_2f52aa89ce97ba46 = function(arg0) {
521
+ imports.wbg.__wbg_constructor_35233efb35960b52 = function(arg0) {
361
522
  const ret = new Error(takeObject(arg0));
362
523
  return addHeapObject(ret);
363
524
  };
@@ -365,7 +526,7 @@ function __wbg_get_imports() {
365
526
  const ret = getObject(arg0) === undefined;
366
527
  return ret;
367
528
  };
368
- imports.wbg.__wbg_constructor_1292ee4141d8f79d = function() {
529
+ imports.wbg.__wbg_constructor_0fbcf25c6da50731 = function() {
369
530
  const ret = new Object();
370
531
  return addHeapObject(ret);
371
532
  };
Binary file
@@ -3,12 +3,21 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function acir_read_bytes(a: number, b: number): number;
5
5
  export function acir_write_bytes(a: number, b: number): void;
6
+ export function __wbg_compilercontext_free(a: number): void;
7
+ export function __wbg_crateid_free(a: number): void;
8
+ export function compilercontext_new(a: number): number;
9
+ export function compilercontext_process_root_crate(a: number, b: number, c: number): number;
10
+ export function compilercontext_process_dependency_crate(a: number, b: number, c: number): number;
11
+ export function compilercontext_add_dependency_edge(a: number, b: number, c: number, d: number, e: number): void;
12
+ export function compilercontext_compile_program(a: number, b: number, c: number): void;
13
+ export function compilercontext_compile_contract(a: number, b: number, c: number): void;
14
+ export function compile_(a: number, b: number, c: number, d: number, e: number, f: number): void;
15
+ export function init_log_level(a: number, b: number): void;
16
+ export function build_info(): number;
6
17
  export function __wbg_pathtofilesourcemap_free(a: number): void;
7
18
  export function pathtofilesourcemap_new(): number;
8
19
  export function pathtofilesourcemap_add_source_code(a: number, b: number, c: number, d: number, e: number): number;
9
20
  export function compile(a: number, b: number, c: number, d: number, e: number, f: number): void;
10
- export function init_log_level(a: number, b: number): void;
11
- export function build_info(): number;
12
21
  export function __wbindgen_export_0(a: number): number;
13
22
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
14
23
  export function __wbindgen_add_to_stack_pointer(a: number): number;