porffor 0.37.7 → 0.37.8

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.
@@ -2964,6 +2964,7 @@ const generateVarDstr = (scope, kind, pattern, init, defaultValue, global) => {
2964
2964
 
2965
2965
  const typed = typedInput && pattern.typeAnnotation;
2966
2966
  let idx = allocVar(scope, name, global, !(typed && extractTypeAnnotation(pattern).type != null));
2967
+ addVarMetadata(scope, name, global, { kind });
2967
2968
 
2968
2969
  if (typed) {
2969
2970
  addVarMetadata(scope, name, global, extractTypeAnnotation(pattern));
@@ -3563,6 +3564,9 @@ const generateAssign = (scope, decl, _global, _name, valueUnused = false) => {
3563
3564
  ];
3564
3565
  }
3565
3566
 
3567
+ // check not const
3568
+ if (local.metadata?.kind === 'const') return internalThrow(scope, 'TypeError', `Cannot assign to constant variable ${name}`, true);
3569
+
3566
3570
  if (op === '=') {
3567
3571
  return setLocalWithType(scope, name, isGlobal, decl.right, true);
3568
3572
  }
@@ -6274,9 +6278,9 @@ export default program => {
6274
6278
  // run callbacks
6275
6279
  const wasm = f.wasm;
6276
6280
  for (let j = 0; j < wasm.length; j++) {
6277
- const i = wasm[j];
6278
- if (i[0] === null && typeof i[1] === 'function') {
6279
- wasm.splice(j, 1, ...i[1]());
6281
+ const o = wasm[j];
6282
+ if (o[0] === null && typeof o[1] === 'function') {
6283
+ wasm.splice(j--, 1, ...o[1]());
6280
6284
  }
6281
6285
  }
6282
6286
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.37.7+d5a49a620",
4
+ "version": "0.37.8+d9c1c7b17",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.37.7+d5a49a620';
3
+ globalThis.version = '0.37.8+d9c1c7b17';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {