porffor 0.27.0 → 0.27.2

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.
@@ -2682,7 +2682,7 @@ const typeSwitch = (scope, type, bc, returns = valtypeBinary) => {
2682
2682
  if (Prefs.typeswitchBrtable)
2683
2683
  return brTable(type, bc, returns);
2684
2684
 
2685
- const tmp = localTmp(scope, '#typeswitch_tmp' + (Prefs.typeswitchUniqueTmp ? randId() : ''), Valtype.i32);
2685
+ const tmp = localTmp(scope, '#typeswitch_tmp' + (Prefs.typeswitchUniqueTmp ? uniqId() : ''), Valtype.i32);
2686
2686
  const out = [
2687
2687
  ...type,
2688
2688
  [ Opcodes.local_set, tmp ],
@@ -2833,7 +2833,7 @@ const generateVar = (scope, decl) => {
2833
2833
  for (const x of decl.declarations) {
2834
2834
  if (x.id.type === 'ArrayPattern') {
2835
2835
  const decls = [];
2836
- const tmpName = '#destructure' + randId();
2836
+ const tmpName = '#destructure' + uniqId();
2837
2837
 
2838
2838
  let i = 0;
2839
2839
  const elements = [...x.id.elements];
@@ -3660,6 +3660,8 @@ const generateDoWhile = (scope, decl) => {
3660
3660
  };
3661
3661
 
3662
3662
  const generateForOf = (scope, decl) => {
3663
+ if (decl.await) return todo(scope, 'for await is not supported');
3664
+
3663
3665
  const out = [];
3664
3666
 
3665
3667
  // todo: for of inside for of might fuck up?
@@ -4487,7 +4489,7 @@ const makeArray = (scope, decl, global = false, name = '$undeclared', initEmpty
4487
4489
 
4488
4490
  const out = [];
4489
4491
 
4490
- const uniqueName = name === '$undeclared' ? name + randId() : name;
4492
+ const uniqueName = name === '$undeclared' ? name + uniqId() : name;
4491
4493
 
4492
4494
  const useRawElements = !!decl.rawElements;
4493
4495
  const elements = useRawElements ? decl.rawElements : decl.elements;
@@ -4748,7 +4750,7 @@ const generateObject = (scope, decl, global = false, name = '$undeclared') => {
4748
4750
  ];
4749
4751
 
4750
4752
  if (decl.properties.length > 0) {
4751
- const tmp = localTmp(scope, `#objectexpr${randId()}`, Valtype.i32);
4753
+ const tmp = localTmp(scope, `#objectexpr${uniqId()}`, Valtype.i32);
4752
4754
  out.push([ Opcodes.local_tee, tmp ]);
4753
4755
 
4754
4756
  for (const x of decl.properties) {
@@ -5162,7 +5164,8 @@ const generateMember = (scope, decl, _global, _name, _objectWasm = undefined) =>
5162
5164
  return out;
5163
5165
  };
5164
5166
 
5165
- const randId = () => '_' + Math.random().toString(16).slice(2, -2).padEnd(12, '0');
5167
+ globalThis._uniqId = 0;
5168
+ const uniqId = () => '_' + globalThis._uniqId++;
5166
5169
 
5167
5170
  let objectHackers = [];
5168
5171
  const objectHack = node => {
@@ -5211,7 +5214,7 @@ const objectHack = node => {
5211
5214
  const generateFunc = (scope, decl) => {
5212
5215
  if (decl.generator) return todo(scope, 'generator functions are not supported');
5213
5216
 
5214
- const name = decl.id ? decl.id.name : `anonymous${randId()}`;
5217
+ const name = decl.id ? decl.id.name : `anonymous${uniqId()}`;
5215
5218
  const params = decl.params ?? [];
5216
5219
 
5217
5220
  // TODO: share scope/locals between !!!
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.27.0+acf68b3a9",
4
+ "version": "0.27.2+14ef42051",
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.27.0+acf68b3a9';
3
+ globalThis.version = '0.27.2+14ef42051';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {