porffor 0.17.0-418ce1445 → 0.17.0-55999d22b

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.
@@ -2,6 +2,8 @@
2
2
  import type {} from './porffor.d.ts';
3
3
 
4
4
  export const btoa = (input: bytestring): bytestring => {
5
+ // todo: throw on invalid chars
6
+
5
7
  const keyStr: bytestring = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
6
8
  const keyStrPtr: i32 = Porffor.wasm`local.get ${keyStr}`;
7
9
 
@@ -41,9 +43,9 @@ export const btoa = (input: bytestring): bytestring => {
41
43
  return output;
42
44
  };
43
45
 
44
- // todo: impl atob by converting below to "porf ts"
45
46
  export const atob = (input: bytestring): bytestring => {
46
- // todo: handle non-base64 chars properly
47
+ // todo: throw on non-base64 chars
48
+
47
49
  const lut: bytestring = '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>@@@?456789:;<=@@@@@@@\x00\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19@@@@@@\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&\'()*+,-./0123';
48
50
  const lutPtr: i32 = Porffor.wasm`local.get ${lut}`;
49
51
 
@@ -195,3 +195,8 @@ export const __Set_prototype_union = (_this: Set, other: any) => {
195
195
  }
196
196
  return out;
197
197
  };
198
+
199
+ export const __Set_prototype_toString = (_this: Set) => {
200
+ const out: bytestring = '[object Set]';
201
+ return out;
202
+ };
@@ -1786,6 +1786,16 @@ export const BuiltinFuncs = function() {
1786
1786
  locals: [124,127,127,127,124,127,127,127],
1787
1787
  localNames: ["_this","_this#type","other","other#type","out","forof_base_pointer","forof_length","forof_counter","x","x#type","#last_type","#typeswitch_tmp"],
1788
1788
  };
1789
+ this.__Set_prototype_toString = {
1790
+ wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __Set_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,18],[15]],
1791
+ params: [124,127],
1792
+ typedParams: true,
1793
+ returns: [124,127],
1794
+ typedReturns: true,
1795
+ locals: [124],
1796
+ localNames: ["_this","_this#type","out"],
1797
+ data: [{"bytes":[12,0,0,0,91,111,98,106,101,99,116,32,83,101,116,93],"offset":0}],
1798
+ };
1789
1799
  this.__String_fromCharCode = {
1790
1800
  wasm: (scope, {allocPage,}) => [[32,0],[65,128,2],[72],[4,64],...number(allocPage(scope, 'bytestring: __String_fromCharCode/out', 'i8') * pageSize, 127),[34,2],[32,0],[58,0,4],[32,2],[65,18],[15],[11],[32,2],[34,3],[65,1],[54,1,0],[32,3],[65,46],[59,0,4],[32,3],[34,2],[32,0],[59,0,4],[32,2],[65,2],[15]],
1791
1801
  params: [127,127],
@@ -2175,7 +2185,7 @@ export const BuiltinFuncs = function() {
2175
2185
  localNames: ["argument","argument#type","number"],
2176
2186
  };
2177
2187
  this.__ecma262_ToString = {
2178
- wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __ecma262_ToString/out', 'i8') * pageSize, 124),[33,2],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[34,3],[68,0,0,0,0,0,0,0,64],[97],[32,3],[68,0,0,0,0,0,0,50,64],[97],[114],[4,64],[32,0],[15],[11],[32,3],[68,0,0,0,0,0,0,24,64],[97],[4,64],...internalThrow(scope, 'TypeError', `Cannot convert a Symbol value to a string`),[11],[32,3],[68,0,0,0,0,0,0,8,64],[97],[4,64],[32,2],[252,3],[34,4],[65,9],[54,1,0],[32,4],[65,245,0],[58,0,4],[32,4],[65,238,0],[58,0,5],[32,4],[65,228,0],[58,0,6],[32,4],[65,229,0],[58,0,7],[32,4],[65,230,0],[58,0,8],[32,4],[65,233,0],[58,0,9],[32,4],[65,238,0],[58,0,10],[32,4],[65,229,0],[58,0,11],[32,4],[65,228,0],[58,0,12],[32,4],[184],[34,2],[15],[11],[32,3],[68,0,0,0,0,0,0,16,64],[97],[32,0],[68,0,0,0,0,0,0,0,0],[97],[113],[4,64],[32,2],[252,3],[34,4],[65,4],[54,1,0],[32,4],[65,238,0],[58,0,4],[32,4],[65,245,0],[58,0,5],[32,4],[65,236,0],[58,0,6],[32,4],[65,236,0],[58,0,7],[32,4],[184],[34,2],[15],[11],[32,3],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,0],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,2],[252,3],[34,4],[65,4],[54,1,0],[32,4],[65,244,0],[58,0,4],[32,4],[65,242,0],[58,0,5],[32,4],[65,245,0],[58,0,6],[32,4],[65,229,0],[58,0,7],[32,4],[184],[34,2],[15],[11],[32,2],[252,3],[34,4],[65,5],[54,1,0],[32,4],[65,230,0],[58,0,4],[32,4],[65,225,0],[58,0,5],[32,4],[65,236,0],[58,0,6],[32,4],[65,243,0],[58,0,7],[32,4],[65,229,0],[58,0,8],[32,4],[184],[34,2],[15],[11],[32,1],[33,6],[2,124],[32,6],[65,0],[70],[4,64,"TYPESWITCH|Number"],[32,0],[32,1],[68,0,0,0,0,0,0,0,0],[65,3],[16, builtin('__Number_prototype_toString')],[26],[12,1],[11],[32,6],[65,1],[70],[4,64,"TYPESWITCH|Boolean"],[32,0],[32,1],[16, builtin('__Boolean_prototype_toString')],[26],[12,1],[11],[32,6],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,0],[252,2],[32,1],[16, builtin('__String_prototype_toString')],[26],[183],[12,1],[11],[32,6],[65,4],[70],[4,64,"TYPESWITCH|Object"],[32,0],[32,1],[16, builtin('__Object_prototype_toString')],[26],[12,1],[11],[32,6],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,0],[32,1],[16, builtin('__Function_prototype_toString')],[26],[12,1],[11],[32,6],[65,6],[70],[4,64,"TYPESWITCH|Symbol"],[32,0],[32,1],[16, builtin('__Symbol_prototype_toString')],[26],[12,1],[11],[32,6],[65,16],[70],[4,64,"TYPESWITCH|Array"],[32,0],[32,1],[16, builtin('__Array_prototype_toString')],[26],[12,1],[11],[32,6],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,0],[252,2],[32,1],[16, builtin('__ByteString_prototype_toString')],[26],[183],[12,1],[11],[32,6],[65,19],[70],[4,64,"TYPESWITCH|Date"],[32,0],[32,1],[16, builtin('__Date_prototype_toString')],[26],[12,1],[11],...internalThrow(scope, 'TypeError', `'toString' proto func tried to be called on a type without an impl`),[11,"TYPESWITCH_end"],[15]],
2188
+ wasm: (scope, {allocPage,builtin,internalThrow,}) => [...number(allocPage(scope, 'bytestring: __ecma262_ToString/out', 'i8') * pageSize, 124),[33,2],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[34,3],[68,0,0,0,0,0,0,0,64],[97],[32,3],[68,0,0,0,0,0,0,50,64],[97],[114],[4,64],[32,0],[15],[11],[32,3],[68,0,0,0,0,0,0,24,64],[97],[4,64],...internalThrow(scope, 'TypeError', `Cannot convert a Symbol value to a string`),[11],[32,3],[68,0,0,0,0,0,0,8,64],[97],[4,64],[32,2],[252,3],[34,4],[65,9],[54,1,0],[32,4],[65,245,0],[58,0,4],[32,4],[65,238,0],[58,0,5],[32,4],[65,228,0],[58,0,6],[32,4],[65,229,0],[58,0,7],[32,4],[65,230,0],[58,0,8],[32,4],[65,233,0],[58,0,9],[32,4],[65,238,0],[58,0,10],[32,4],[65,229,0],[58,0,11],[32,4],[65,228,0],[58,0,12],[32,4],[184],[34,2],[15],[11],[32,3],[68,0,0,0,0,0,0,16,64],[97],[32,0],[68,0,0,0,0,0,0,0,0],[97],[113],[4,64],[32,2],[252,3],[34,4],[65,4],[54,1,0],[32,4],[65,238,0],[58,0,4],[32,4],[65,245,0],[58,0,5],[32,4],[65,236,0],[58,0,6],[32,4],[65,236,0],[58,0,7],[32,4],[184],[34,2],[15],[11],[32,3],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,0],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,2],[252,3],[34,4],[65,4],[54,1,0],[32,4],[65,244,0],[58,0,4],[32,4],[65,242,0],[58,0,5],[32,4],[65,245,0],[58,0,6],[32,4],[65,229,0],[58,0,7],[32,4],[184],[34,2],[15],[11],[32,2],[252,3],[34,4],[65,5],[54,1,0],[32,4],[65,230,0],[58,0,4],[32,4],[65,225,0],[58,0,5],[32,4],[65,236,0],[58,0,6],[32,4],[65,243,0],[58,0,7],[32,4],[65,229,0],[58,0,8],[32,4],[184],[34,2],[15],[11],[32,1],[33,6],[2,124],[32,6],[65,0],[70],[4,64,"TYPESWITCH|Number"],[32,0],[32,1],[68,0,0,0,0,0,0,0,0],[65,3],[16, builtin('__Number_prototype_toString')],[26],[12,1],[11],[32,6],[65,1],[70],[4,64,"TYPESWITCH|Boolean"],[32,0],[32,1],[16, builtin('__Boolean_prototype_toString')],[26],[12,1],[11],[32,6],[65,2],[70],[4,64,"TYPESWITCH|String"],[32,0],[252,2],[32,1],[16, builtin('__String_prototype_toString')],[26],[183],[12,1],[11],[32,6],[65,4],[70],[4,64,"TYPESWITCH|Object"],[32,0],[32,1],[16, builtin('__Object_prototype_toString')],[26],[12,1],[11],[32,6],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,0],[32,1],[16, builtin('__Function_prototype_toString')],[26],[12,1],[11],[32,6],[65,6],[70],[4,64,"TYPESWITCH|Symbol"],[32,0],[32,1],[16, builtin('__Symbol_prototype_toString')],[26],[12,1],[11],[32,6],[65,16],[70],[4,64,"TYPESWITCH|Array"],[32,0],[32,1],[16, builtin('__Array_prototype_toString')],[26],[12,1],[11],[32,6],[65,18],[70],[4,64,"TYPESWITCH|ByteString"],[32,0],[252,2],[32,1],[16, builtin('__ByteString_prototype_toString')],[26],[183],[12,1],[11],[32,6],[65,19],[70],[4,64,"TYPESWITCH|Date"],[32,0],[32,1],[16, builtin('__Date_prototype_toString')],[26],[12,1],[11],[32,6],[65,20],[70],[4,64,"TYPESWITCH|Set"],[32,0],[32,1],[16, builtin('__Set_prototype_toString')],[26],[12,1],[11],...internalThrow(scope, 'TypeError', `'toString' proto func tried to be called on a type without an impl`),[11,"TYPESWITCH_end"],[15]],
2179
2189
  params: [124,127],
2180
2190
  typedParams: true,
2181
2191
  returns: [124],
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.17.0-418ce1445",
4
+ "version": "0.17.0-55999d22b",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},