@hew-lang/wasm 0.6.0 → 0.6.1

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hew-lang/wasm",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for Hew analysis and verified sandbox compilation",
5
- "version": "0.6.0",
5
+ "version": "0.6.1",
6
6
  "license": "MIT OR Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "webassembly"
27
27
  ],
28
28
  "hewSource": {
29
- "commit": "c4b08fc6215201308794f6093aa67eb173eda1fd",
30
- "tag": "v0.6.0",
29
+ "commit": "6a446f773391f45d2c0ce0a799240b8b9afef54e",
30
+ "tag": "v0.6.1",
31
31
  "dirty": false
32
32
  },
33
33
  "publishConfig": {
package/wasm.d.ts CHANGED
@@ -71,6 +71,15 @@ export function document_symbols(source: string): string;
71
71
  */
72
72
  export function executeCodec(request: string): string;
73
73
 
74
+ /**
75
+ * Render the macro expansion at a byte offset using the shared frontend.
76
+ *
77
+ * # Errors
78
+ *
79
+ * Returns an error when loading or expansion fails, or no expansion covers the offset.
80
+ */
81
+ export function expand_macro(source: string, offset: number): string;
82
+
74
83
  /**
75
84
  * Find all references at offset. Returns JSON `{ name, spans }` or `"null"` if no symbol found.
76
85
  *
@@ -208,6 +217,7 @@ export interface InitOutput {
208
217
  readonly complete: (a: number, b: number, c: number, d: number) => void;
209
218
  readonly document_symbols: (a: number, b: number, c: number) => void;
210
219
  readonly executeCodec: (a: number, b: number, c: number) => void;
220
+ readonly expand_macro: (a: number, b: number, c: number, d: number) => void;
211
221
  readonly find_references: (a: number, b: number, c: number, d: number) => void;
212
222
  readonly folding_ranges: (a: number, b: number, c: number) => void;
213
223
  readonly format_source: (a: number, b: number, c: number) => void;
package/wasm.js CHANGED
@@ -247,6 +247,43 @@ export function executeCodec(request) {
247
247
  }
248
248
  }
249
249
 
250
+ /**
251
+ * Render the macro expansion at a byte offset using the shared frontend.
252
+ *
253
+ * # Errors
254
+ *
255
+ * Returns an error when loading or expansion fails, or no expansion covers the offset.
256
+ * @param {string} source
257
+ * @param {number} offset
258
+ * @returns {string}
259
+ */
260
+ export function expand_macro(source, offset) {
261
+ let deferred3_0;
262
+ let deferred3_1;
263
+ try {
264
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ wasm.expand_macro(retptr, ptr0, len0, offset);
268
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
269
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
270
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
271
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
272
+ var ptr2 = r0;
273
+ var len2 = r1;
274
+ if (r3) {
275
+ ptr2 = 0; len2 = 0;
276
+ throw takeObject(r2);
277
+ }
278
+ deferred3_0 = ptr2;
279
+ deferred3_1 = len2;
280
+ return getStringFromWasm0(ptr2, len2);
281
+ } finally {
282
+ wasm.__wbindgen_add_to_stack_pointer(16);
283
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
284
+ }
285
+ }
286
+
250
287
  /**
251
288
  * Find all references at offset. Returns JSON `{ name, spans }` or `"null"` if no symbol found.
252
289
  *
package/wasm_bg.wasm CHANGED
Binary file