porffor 0.50.28 → 0.50.29

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.
@@ -1,7 +1,10 @@
1
1
  export default () => {
2
2
  let out = '';
3
3
 
4
- const error = name => out += `export const ${name} = function (message: any) {
4
+ const errors = [];
5
+ const error = name => {
6
+ errors.push(name);
7
+ out += `export const ${name} = function (message: any) {
5
8
  if (message === undefined) message = '';
6
9
  else message = ecma262.ToString(message);
7
10
 
@@ -25,6 +28,7 @@ export const __${name}_prototype_toString = (_this: ${name}) => {
25
28
 
26
29
  return obj.name + ': ' + message;
27
30
  };`;
31
+ };
28
32
 
29
33
  error('Error');
30
34
  error('AggregateError');
@@ -38,7 +42,12 @@ export const __${name}_prototype_toString = (_this: ${name}) => {
38
42
  error('Test262Error');
39
43
  error('TodoError');
40
44
 
41
- out += `\nexport const __Test262Error_thrower = message => { throw new Test262Error(message); };`;
45
+ out += `
46
+ export const __Test262Error_thrower = message => {
47
+ throw new Test262Error(message);
48
+ };
49
+
50
+ export const __Error_isError = (x: unknown): boolean => Porffor.fastOr(${errors.map(x => `Porffor.rawType(x) == Porffor.TYPES.${x.toLowerCase()}`).join(', ')});`;
42
51
 
43
52
  return out;
44
53
  };
@@ -14,4 +14,9 @@ export const __Function_prototype_toLocaleString = (_this: Function) => __Functi
14
14
  export const __Function_prototype_apply = (_this: Function, thisArg: any, argsArray: any) => {
15
15
  argsArray = Array.from(argsArray ?? []);
16
16
  return Reflect.apply(_this, thisArg, argsArray);
17
+ };
18
+
19
+ export const __Function_prototype_bind = (_this: Function, thisArg: any, argsArray: any) => {
20
+ // todo: no good way to bind without dynamic functions or closure yet, just return function
21
+ return _this;
17
22
  };
@@ -1691,6 +1691,11 @@ params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
1691
1691
  locals:[],localNames:["message","message#type"],
1692
1692
  usesTag:1,
1693
1693
  }
1694
+ this.__Error_isError = {
1695
+ wasm:()=>[[32,1],[184],[68,40],[97],[32,1],[184],[68,41],[97],[114],[32,1],[184],[68,42],[97],[114],[32,1],[184],[68,43],[97],[114],[32,1],[184],[68,44],[97],[114],[32,1],[184],[68,45],[97],[114],[32,1],[184],[68,46],[97],[114],[32,1],[184],[68,47],[97],[114],[32,1],[184],[68,48],[97],[114],[32,1],[184],[68,49],[97],[114],[184],[65,2],[15]],
1696
+ params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
1697
+ locals:[],localNames:["x","x#type"],
1698
+ }
1694
1699
  this.escape = {
1695
1700
  wasm:(_,{i32ify,makeString,builtin})=>[...i32ify(makeString(_,"\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0001\\u0001\\u0000\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0000\\u0000\\u0000\\u0000\\u0001\\u0000\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000",1)),[33,2],[32,0],[40,1,0],[34,3],[33,4],[32,0],[33,5],[32,1],[65,195,1],[70],[4,64],[32,5],[32,3],[106],[33,6],[3,64],[32,5],[32,6],[72],[4,64],[32,5],[32,5],[65,1],[106],[33,5],[45,0,4],[34,7],[65,128,1],[72],[4,64],[32,2],[32,7],[106],[45,0,4],[4,64],[12,3],[26],[11],[11],[32,4],[65,2],[106],[33,4],[12,1],[11],[11],[32,4],[32,3],[70],[4,64],[32,0],[32,1],[15],[26],[11],[16,builtin('__Porffor_allocate')],[34,8],[32,4],[54,1,0],[32,0],[33,5],[32,8],[33,9],[3,64],[32,5],[32,6],[72],[4,64],[32,5],[32,5],[65,1],[106],[33,5],[45,0,4],[34,7],[65,128,1],[72],[4,64],[32,2],[32,7],[106],[45,0,4],[4,64],[32,9],[32,9],[65,1],[106],[33,9],[32,7],[58,0,4],[12,3],[26],[11],[11],[32,9],[32,9],[65,1],[106],[33,9],[65,37],[58,0,4],[32,7],[65,15],[113],[65,48],[106],[34,10],[65,57],[74],[4,64],[32,10],[65,7],[106],[33,10],[11],[32,7],[65,4],[117],[65,48],[106],[34,11],[65,57],[74],[4,64],[32,11],[65,7],[106],[33,11],[11],[32,9],[32,9],[65,1],[106],[33,9],[32,11],[58,0,4],[32,9],[32,9],[65,1],[106],[33,9],[32,10],[58,0,4],[12,1],[11],[11],[32,8],[65,195,1],[15],[26],[11],[32,5],[32,3],[65,2],[108],[106],[33,6],[3,64],[32,5],[32,6],[72],[4,64],[32,5],[47,0,4],[33,7],[32,5],[65,2],[106],[33,5],[32,7],[65,128,1],[72],[4,64],[32,2],[32,7],[106],[45,0,4],[4,64],[12,3],[26],[11],[11],[32,7],[65,128,2],[72],[4,64],[32,4],[65,2],[106],[33,4],[5],[32,4],[65,5],[106],[33,4],[11],[12,1],[11],[11],[32,4],[32,3],[70],[4,64],[32,0],[32,1],[15],[26],[11],[16,builtin('__Porffor_allocate')],[34,8],[32,4],[54,1,0],[32,0],[33,5],[32,8],[33,9],[3,64],[32,5],[32,6],[72],[4,64],[32,5],[47,0,4],[33,7],[32,5],[65,2],[106],[33,5],[32,7],[65,128,1],[72],[4,64],[32,2],[32,7],[106],[45,0,4],[4,64],[32,9],[32,9],[65,1],[106],[33,9],[32,7],[58,0,4],[12,3],[26],[11],[11],[32,7],[65,128,2],[72],[4,64],[32,9],[32,9],[65,1],[106],[33,9],[65,37],[58,0,4],[32,7],[65,15],[113],[65,48],[106],[34,10],[65,57],[74],[4,64],[32,10],[65,7],[106],[33,10],[11],[32,7],[65,4],[117],[65,48],[106],[34,11],[65,57],[74],[4,64],[32,11],[65,7],[106],[33,11],[11],[32,9],[32,9],[65,1],[106],[33,9],[32,11],[58,0,4],[32,9],[32,9],[65,1],[106],[33,9],[32,10],[58,0,4],[5],[32,9],[65,165,234,1],[59,0,4],[32,9],[65,2],[106],[33,9],[32,7],[65,12],[117],[65,15],[113],[65,48],[106],[34,12],[65,57],[74],[4,64],[32,12],[65,7],[106],[33,12],[11],[32,9],[32,9],[65,1],[106],[33,9],[32,12],[58,0,4],[32,7],[65,8],[117],[65,15],[113],[65,48],[106],[34,12],[65,57],[74],[4,64],[32,12],[65,7],[106],[33,12],[11],[32,9],[32,9],[65,1],[106],[33,9],[32,12],[58,0,4],[32,7],[65,4],[117],[65,15],[113],[65,48],[106],[34,12],[65,57],[74],[4,64],[32,12],[65,7],[106],[33,12],[11],[32,9],[32,9],[65,1],[106],[33,9],[32,12],[58,0,4],[32,7],[65,15],[113],[65,48],[106],[34,12],[65,57],[74],[4,64],[32,12],[65,7],[106],[33,12],[11],[32,9],[32,9],[65,1],[106],[33,9],[32,12],[58,0,4],[11],[12,1],[11],[11],[32,8],[65,195,1],[15]],
1696
1701
  params:[127,127],typedParams:1,returns:[127,127],typedReturns:1,
@@ -1717,6 +1722,12 @@ locals:[124,124,127,127],localNames:["_this","_this#type","thisArg","thisArg#typ
1717
1722
  usedTypes:[80],
1718
1723
  usesTag:1,
1719
1724
  }
1725
+ this.__Function_prototype_bind = {
1726
+ wasm:(_,{internalThrow})=>[[32,1],[65,6],[71],[4,64],...internalThrow(_,'TypeError',`Function.prototype.bind expects 'this' to be a Function`),[11],[32,0],[65,6],[15]],
1727
+ params:[124,127,124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
1728
+ locals:[],localNames:["_this","_this#type","thisArg","thisArg#type","argsArray","argsArray#type"],
1729
+ usesTag:1,
1730
+ }
1720
1731
  this.__Porffor_Generator = {
1721
1732
  wasm:()=>[[32,0],[34,2],[65,50],[15]],
1722
1733
  params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
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.50.28",
4
+ "version": "0.50.29",
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.50.28';
3
+ globalThis.version = '0.50.29';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
@@ -162,7 +162,7 @@ if (process.argv.length >= 4) {
162
162
  }
163
163
  }
164
164
 
165
- if (file.startsWith('https://')) { // https only :)
165
+ if (file && file.startsWith('https://')) { // https only :)
166
166
  // rce warning, make user confirm (disabled)
167
167
  // const rl = (await import('readline')).createInterface({ input: process.stdin, output: process.stdout });
168
168
  // const ans = await new Promise(resolve => rl.question(`\u001b[1mAre you sure you want to download this URL:\u001b[0m ${file} (y/n)? `, ans => {