porffor 0.28.0 → 0.28.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.
@@ -1486,7 +1486,7 @@ const getNodeType = (scope, node) => {
1486
1486
  if (scope.locals['#last_type']) return getLastType(scope);
1487
1487
 
1488
1488
  // presume
1489
- // todo: warn here?
1489
+ if (Prefs.warnAssumedType) console.warn(`Indirect call assumed to be number`);
1490
1490
  return TYPES.number;
1491
1491
  }
1492
1492
 
@@ -1524,7 +1524,7 @@ const getNodeType = (scope, node) => {
1524
1524
  if (scope.locals['#last_type']) return getLastType(scope);
1525
1525
 
1526
1526
  // presume
1527
- // todo: warn here?
1527
+ if (Prefs.warnAssumedType) console.warn(`Call to ${name} assumed to be number`);
1528
1528
  return TYPES.number;
1529
1529
 
1530
1530
  // let protoFunc;
@@ -1633,6 +1633,7 @@ const getNodeType = (scope, node) => {
1633
1633
  if (scope.locals['#last_type']) return getLastType(scope);
1634
1634
 
1635
1635
  // presume
1636
+ if (Prefs.warnAssumedType) console.warn(`Member access to field .${name} assumed to be number`);
1636
1637
  return TYPES.number;
1637
1638
  }
1638
1639
 
@@ -1664,7 +1665,7 @@ const getNodeType = (scope, node) => {
1664
1665
  if (scope.locals['#last_type']) return getLastType(scope);
1665
1666
 
1666
1667
  // presume
1667
- // todo: warn here?
1668
+ if (Prefs.warnAssumedType) console.warn(`AST node ${node.type} assumed to be number`);
1668
1669
  return TYPES.number;
1669
1670
  })();
1670
1671
 
@@ -5570,6 +5571,16 @@ const internalConstrs = {
5570
5571
  type: TYPES.undefined,
5571
5572
  notConstr: true,
5572
5573
  length: 1
5574
+ },
5575
+
5576
+ __Porffor_rawType: {
5577
+ generate: (scope, decl) => [
5578
+ ...getNodeType(scope, decl.arguments[0]),
5579
+ Opcodes.i32_from_u
5580
+ ],
5581
+ type: TYPES.number,
5582
+ notConstr: true,
5583
+ length: 1
5573
5584
  }
5574
5585
  };
5575
5586
 
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.28.0+2cee067f8",
4
+ "version": "0.28.1+ae39ecbbe",
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.28.0+2cee067f8';
3
+ globalThis.version = '0.28.1+ae39ecbbe';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {