porffor 0.27.1 → 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];
@@ -4489,7 +4489,7 @@ const makeArray = (scope, decl, global = false, name = '$undeclared', initEmpty
4489
4489
 
4490
4490
  const out = [];
4491
4491
 
4492
- const uniqueName = name === '$undeclared' ? name + randId() : name;
4492
+ const uniqueName = name === '$undeclared' ? name + uniqId() : name;
4493
4493
 
4494
4494
  const useRawElements = !!decl.rawElements;
4495
4495
  const elements = useRawElements ? decl.rawElements : decl.elements;
@@ -4750,7 +4750,7 @@ const generateObject = (scope, decl, global = false, name = '$undeclared') => {
4750
4750
  ];
4751
4751
 
4752
4752
  if (decl.properties.length > 0) {
4753
- const tmp = localTmp(scope, `#objectexpr${randId()}`, Valtype.i32);
4753
+ const tmp = localTmp(scope, `#objectexpr${uniqId()}`, Valtype.i32);
4754
4754
  out.push([ Opcodes.local_tee, tmp ]);
4755
4755
 
4756
4756
  for (const x of decl.properties) {
@@ -5164,7 +5164,8 @@ const generateMember = (scope, decl, _global, _name, _objectWasm = undefined) =>
5164
5164
  return out;
5165
5165
  };
5166
5166
 
5167
- const randId = () => '_' + Math.random().toString(16).slice(2, -2).padEnd(12, '0');
5167
+ globalThis._uniqId = 0;
5168
+ const uniqId = () => '_' + globalThis._uniqId++;
5168
5169
 
5169
5170
  let objectHackers = [];
5170
5171
  const objectHack = node => {
@@ -5213,7 +5214,7 @@ const objectHack = node => {
5213
5214
  const generateFunc = (scope, decl) => {
5214
5215
  if (decl.generator) return todo(scope, 'generator functions are not supported');
5215
5216
 
5216
- const name = decl.id ? decl.id.name : `anonymous${randId()}`;
5217
+ const name = decl.id ? decl.id.name : `anonymous${uniqId()}`;
5217
5218
  const params = decl.params ?? [];
5218
5219
 
5219
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.1+eb4ce4d61",
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.1+eb4ce4d61';
3
+ globalThis.version = '0.27.2+14ef42051';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {