porffor 0.2.0-e69a2a2 → 0.2.0-edb06b8

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.
package/CONTRIBUTING.md CHANGED
@@ -229,7 +229,7 @@ builtins/tostring_number: impl radix
229
229
 
230
230
  ## Test262
231
231
 
232
- Make sure you have Test262 cloned already **inside of `test262/`** (`git clone https://github.com/tc39/test262.git test262/test262`).
232
+ Make sure you have Test262 cloned already **inside of `test262/`** (`git clone https://github.com/tc39/test262.git test262/test262`) and run `npm install` inside `test262/` too.
233
233
 
234
234
  Run `node test262` to run all the tests and get an output of total overall test results. The main thing you want to pay attention to is the emoji summary (lol):
235
235
  ```
@@ -142,4 +142,8 @@ export const __Array_prototype_toReversed = (_this: any[]) => {
142
142
  }
143
143
 
144
144
  return out;
145
+ };
146
+
147
+ export const __Array_prototype_valueOf = (_this: any[]) => {
148
+ return _this;
145
149
  };
@@ -1,3 +1,17 @@
1
+ // @porf --funsafe-no-unlikely-proto-checks
2
+
3
+ // 20.3.3.2 Boolean.prototype.toString ()
4
+ // https://tc39.es/ecma262/#sec-boolean.prototype.tostring
5
+ export const __Boolean_prototype_toString = (_this: boolean) => {
6
+ // 1. Let b be ? ThisBooleanValue(this value).
7
+ // 2. If b is true, return "true"; else return "false".
8
+ let out: bytestring = '';
9
+ if (_this) out = 'true';
10
+ else out = 'false';
11
+
12
+ return out;
13
+ };
14
+
1
15
  // 20.3.3.3 Boolean.prototype.valueOf ()
2
16
  // https://tc39.es/ecma262/#sec-boolean.prototype.valueof
3
17
  export const __Boolean_prototype_valueOf = (_this: boolean) => {
@@ -1,5 +1,7 @@
1
1
  // @porf --funsafe-no-unlikely-proto-checks --valtype=i32
2
2
 
3
+ import type {} from './porffor';
4
+
3
5
  export const escape = (input: string|bytestring): bytestring => {
4
6
  // we have no byte array yet so use bytestring with 0x00 and 0x01 via escape characters
5
7
  // 0 = should escape, 1 = should not escape
@@ -0,0 +1,7 @@
1
+ // // @porf --funsafe-no-unlikely-proto-checks
2
+
3
+ export const __Function_prototype_toString = (_this: Function) => {
4
+ // todo: actually use source
5
+ let out: bytestring = 'function () {}';
6
+ return out;
7
+ };
@@ -0,0 +1,6 @@
1
+ // // @porf --funsafe-no-unlikely-proto-checks
2
+
3
+ export const __Object_prototype_toString = (_this: object) => {
4
+ let out: bytestring = '[object Object]';
5
+ return out;
6
+ };
@@ -1054,6 +1054,18 @@ export const __ByteString_prototype_trim = (_this: bytestring) => {
1054
1054
  return __ByteString_prototype_trimStart(__ByteString_prototype_trimEnd(_this));
1055
1055
  };
1056
1056
 
1057
+ // 22.1.3.29 String.prototype.toString ()
1058
+ // https://tc39.es/ecma262/#sec-string.prototype.tostring
1059
+ export const __String_prototype_toString = (_this: string) => {
1060
+ // 1. Return ? ThisStringValue(this value).
1061
+ return _this;
1062
+ };
1063
+
1064
+ export const __ByteString_prototype_toString = (_this: bytestring) => {
1065
+ // 1. Return ? ThisStringValue(this value).
1066
+ return _this;
1067
+ };
1068
+
1057
1069
 
1058
1070
  // 22.1.3.35 String.prototype.valueOf ()
1059
1071
  // https://tc39.es/ecma262/#sec-string.prototype.valueof
@@ -1062,8 +1074,6 @@ export const __String_prototype_valueOf = (_this: string) => {
1062
1074
  return _this;
1063
1075
  };
1064
1076
 
1065
- // 22.1.3.35 String.prototype.valueOf ()
1066
- // https://tc39.es/ecma262/#sec-string.prototype.valueof
1067
1077
  export const __ByteString_prototype_valueOf = (_this: bytestring) => {
1068
1078
  // 1. Return ? ThisStringValue(this value).
1069
1079
  return _this;
@@ -3249,7 +3249,7 @@ export const generateMember = (scope, decl, _global, _name) => {
3249
3249
  // eg: __String_prototype_toLowerCase -> toLowerCase
3250
3250
  if (nameProp.startsWith('__')) nameProp = nameProp.split('_').pop();
3251
3251
 
3252
- return makeString(scope, name, _global, _name, true);
3252
+ return makeString(scope, nameProp, _global, _name, true);
3253
3253
  } else {
3254
3254
  return generate(scope, DEFAULT_VALUE);
3255
3255
  }
@@ -297,6 +297,15 @@ export const BuiltinFuncs = function() {
297
297
  localNames: ["_this","_this#type","len","start","end","out","#makearray_pointer_tmp","__length_setter_tmp","__member_setter_val_tmp","#last_type"],
298
298
  exceptions: [{"constructor":"TypeError","message":"Member expression is not supported for non-string non-array yet","exceptId":8},{"constructor":"TypeError","message":"Cannot assign member with non-array","exceptId":9},{"constructor":"TypeError","message":"Member expression is not supported for non-string non-array yet","exceptId":10},{"constructor":"TypeError","message":"Cannot assign member with non-array","exceptId":11}],
299
299
  };
300
+ this.__Array_prototype_valueOf = {
301
+ wasm: (scope, { allocPage, builtin }) => [[32,0],[65,16],[15]],
302
+ params: [124,127],
303
+ typedParams: true,
304
+ returns: [124,127],
305
+ typedReturns: true,
306
+ locals: [],
307
+ localNames: ["_this","_this#type"],
308
+ };
300
309
  this.btoa = {
301
310
  wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'bytestring: btoa/keyStr', 'i8') * pageSize, 127),[34,2],[33,3],[32,0],[40,1,0],[33,4],...number(allocPage(scope, 'bytestring: btoa/output', 'i8') * pageSize, 127),[34,5],[65,4],[32,4],[65,3],[109],[32,4],[65,3],[111],[69],[69],[106],[108],[34,6],[54,1,0],[32,0],[33,7],[32,5],[33,8],[32,7],[32,4],[106],[33,9],[65,0],[33,10],[3,64],[32,7],[32,9],[72],[4,64],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[33,11],[32,7],[32,9],[72],[4,127],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[65,0],[33,13],[5],[65,127],[65,0],[33,13],[11],[33,12],[32,7],[32,9],[72],[4,127],[32,7],[32,7],[65,1],[106],[33,7],[45,0,4],[65,0],[33,13],[5],[65,127],[65,0],[33,13],[11],[33,14],[32,11],[65,2],[117],[33,15],[32,11],[65,3],[113],[65,4],[116],[32,12],[65,127],[70],[4,127],[65,0],[65,0],[33,13],[5],[32,12],[65,4],[117],[65,0],[33,13],[11],[114],[33,16],[32,12],[65,15],[113],[65,2],[116],[32,14],[65,127],[70],[4,127],[65,0],[65,0],[33,13],[5],[32,14],[65,6],[117],[65,0],[33,13],[11],[114],[33,17],[32,14],[65,63],[113],[33,18],[32,12],[65,127],[70],[4,64],[65,192,0],[33,17],[65,192,0],[33,18],[5],[32,14],[65,127],[70],[4,64],[65,192,0],[33,18],[11],[11],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,15],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,16],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,17],[106],[45,0,4],[58,0,4],[32,8],[32,8],[65,1],[106],[33,8],[32,3],[32,18],[106],[45,0,4],[58,0,4],[12,1],[11],[11],[32,5],[15]],
302
311
  params: [127,127],
@@ -307,6 +316,15 @@ export const BuiltinFuncs = function() {
307
316
  localNames: ["input","input#type","keyStr","keyStrPtr","len","output","__length_setter_tmp","i","j","endPtr","endPtr#type","chr1","chr2","#last_type","chr3","enc1","enc2","enc3","enc4"],
308
317
  data: [{"offset":0,"bytes":[65,0,0,0,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47,61]}],
309
318
  };
319
+ this.__Boolean_prototype_toString = {
320
+ wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'bytestring: __Boolean_prototype_toString/out', 'i8') * pageSize, 124),[33,2],[32,0],[252,3],[4,64],[32,2],[252,3],[34,3],[65,4],[54,1,0],[32,3],[65,244,0],[58,0,4],[32,3],[65,242,0],[58,0,5],[32,3],[65,245,0],[58,0,6],[32,3],[65,229,0],[58,0,7],[32,3],[184],[33,2],[5],[32,2],[252,3],[34,3],[65,5],[54,1,0],[32,3],[65,230,0],[58,0,4],[32,3],[65,225,0],[58,0,5],[32,3],[65,236,0],[58,0,6],[32,3],[65,243,0],[58,0,7],[32,3],[65,229,0],[58,0,8],[32,3],[184],[33,2],[11],[32,2],[65,18],[15]],
321
+ params: [124,127],
322
+ typedParams: true,
323
+ returns: [124,127],
324
+ typedReturns: true,
325
+ locals: [124,127],
326
+ localNames: ["_this","_this#type","out","#makearray_pointer_tmp"],
327
+ };
310
328
  this.__Boolean_prototype_valueOf = {
311
329
  wasm: (scope, { allocPage, builtin }) => [[32,0],[65,1],[15]],
312
330
  params: [124,127],
@@ -1122,6 +1140,16 @@ export const BuiltinFuncs = function() {
1122
1140
  localNames: ["input","input#type","lut","len","outLength","i","endPtr","chr","output","__length_setter_tmp","j","lower","upper","#makearray_pointer_tmp","nibble"],
1123
1141
  data: [{"offset":0,"bytes":[128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0]}],
1124
1142
  };
1143
+ this.__Function_prototype_toString = {
1144
+ wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'bytestring: __Function_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,18],[15]],
1145
+ params: [124,127],
1146
+ typedParams: true,
1147
+ returns: [124,127],
1148
+ typedReturns: true,
1149
+ locals: [124],
1150
+ localNames: ["_this","_this#type","out"],
1151
+ data: [{"offset":0,"bytes":[14,0,0,0,102,117,110,99,116,105,111,110,32,40,41,32,123,125]}],
1152
+ };
1125
1153
  this.parseInt = {
1126
1154
  wasm: (scope, { allocPage, builtin }) => [[32,2],[65,0],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,0,0],[98],[4,64],[68,0,0,0,0,0,0,36,64],[33,2],[11],[32,2],[68,0,0,0,0,0,0,0,0],[97],[4,64],[68,0,0,0,0,0,0,36,64],[33,2],[11],[32,2],[68,0,0,0,0,0,0,0,64],[99],[34,4],[69],[4,127],[32,2],[68,0,0,0,0,0,0,66,64],[100],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[68,0,0,0,0,0,0,248,127],[15],[11],[68,0,0,0,0,0,0,77,64],[33,6],[32,2],[68,0,0,0,0,0,0,36,64],[99],[4,64],[68,0,0,0,0,0,0,72,64],[32,2],[160],[33,6],[11],[68,0,0,0,0,0,0,248,127],[33,7],[32,0],[34,8],[252,2],[40,0,0],[183],[33,9],[32,8],[33,10],[68,0,0,0,0,0,0,0,0],[33,11],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,50,64],[97],[4,64],[32,10],[32,9],[160],[33,12],[32,10],[252,2],[45,0,4],[183],[34,13],[68,0,0,0,0,0,128,69,64],[97],[4,64],[32,10],[68,0,0,0,0,0,0,240,63],[160],[33,10],[11],[32,13],[68,0,0,0,0,0,128,70,64],[97],[4,64],[68,0,0,0,0,0,0,240,63],[33,11],[32,10],[68,0,0,0,0,0,0,240,63],[160],[33,10],[11],[32,13],[68,0,0,0,0,0,0,72,64],[97],[4,64],[32,10],[68,0,0,0,0,0,0,240,63],[160],[252,2],[45,0,4],[183],[34,14],[68,0,0,0,0,0,0,94,64],[97],[34,4],[69],[4,127],[32,14],[68,0,0,0,0,0,0,86,64],[97],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,10],[68,0,0,0,0,0,0,0,64],[160],[33,10],[68,0,0,0,0,0,0,48,64],[33,2],[11],[11],[3,64],[32,10],[32,12],[99],[4,64],[32,10],[32,10],[68,0,0,0,0,0,0,240,63],[160],[33,10],[252,2],[45,0,4],[183],[34,15],[68,0,0,0,0,0,0,72,64],[102],[34,4],[4,127],[32,15],[32,6],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,0,72,64],[161],[160],[33,7],[5],[32,2],[68,0,0,0,0,0,0,36,64],[100],[4,64],[32,15],[68,0,0,0,0,0,64,88,64],[102],[34,4],[4,127],[32,15],[68,0,0,0,0,0,192,85,64],[32,2],[160],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,192,85,64],[161],[160],[33,7],[5],[32,15],[68,0,0,0,0,0,64,80,64],[102],[34,4],[4,127],[32,15],[68,0,0,0,0,0,128,75,64],[32,2],[160],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,128,75,64],[161],[160],[33,7],[5],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[11],[5],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[11],[12,1],[11],[11],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[32,10],[32,9],[68,0,0,0,0,0,0,0,64],[162],[160],[33,12],[32,10],[252,2],[47,0,4],[183],[34,13],[68,0,0,0,0,0,128,69,64],[97],[4,64],[32,10],[68,0,0,0,0,0,0,0,64],[160],[33,10],[11],[32,13],[68,0,0,0,0,0,128,70,64],[97],[4,64],[68,0,0,0,0,0,0,240,63],[33,11],[32,10],[68,0,0,0,0,0,0,0,64],[160],[33,10],[11],[32,13],[68,0,0,0,0,0,0,72,64],[97],[4,64],[32,10],[68,0,0,0,0,0,0,0,64],[160],[252,2],[47,0,4],[183],[34,14],[68,0,0,0,0,0,0,94,64],[97],[34,4],[69],[4,127],[32,14],[68,0,0,0,0,0,0,86,64],[97],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,10],[68,0,0,0,0,0,0,16,64],[160],[33,10],[68,0,0,0,0,0,0,48,64],[33,2],[11],[11],[3,64],[32,10],[32,12],[99],[4,64],[32,10],[252,2],[47,0,4],[183],[33,15],[32,10],[68,0,0,0,0,0,0,0,64],[160],[33,10],[32,15],[68,0,0,0,0,0,0,72,64],[102],[34,4],[4,127],[32,15],[32,6],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,0,72,64],[161],[160],[33,7],[5],[32,2],[68,0,0,0,0,0,0,36,64],[100],[4,64],[32,15],[68,0,0,0,0,0,64,88,64],[102],[34,4],[4,127],[32,15],[68,0,0,0,0,0,192,85,64],[32,2],[160],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,192,85,64],[161],[160],[33,7],[5],[32,15],[68,0,0,0,0,0,64,80,64],[102],[34,4],[4,127],[32,15],[68,0,0,0,0,0,128,75,64],[32,2],[160],[99],[65,1],[33,5],[5],[32,4],[65,1],[33,5],[11],[4,64],[32,7],[16, builtin('__Number_isNaN')],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[33,7],[11],[32,7],[32,2],[162],[34,7],[32,15],[68,0,0,0,0,0,128,75,64],[161],[160],[33,7],[5],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[11],[5],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15],[11],[11],[12,1],[11],[11],[32,11],[252,3],[4,64],[32,7],[154],[15],[11],[32,7],[15]],
1127
1155
  params: [124,127,124,127],
@@ -1167,6 +1195,16 @@ export const BuiltinFuncs = function() {
1167
1195
  locals: [],
1168
1196
  localNames: ["_this","_this#type"],
1169
1197
  };
1198
+ this.__Object_prototype_toString = {
1199
+ wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'bytestring: __Object_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,18],[15]],
1200
+ params: [124,127],
1201
+ typedParams: true,
1202
+ returns: [124,127],
1203
+ typedReturns: true,
1204
+ locals: [124],
1205
+ localNames: ["_this","_this#type","out"],
1206
+ data: [{"offset":0,"bytes":[15,0,0,0,91,111,98,106,101,99,116,32,79,98,106,101,99,116,93]}],
1207
+ };
1170
1208
  this.__String_fromCharCode = {
1171
1209
  wasm: (scope, { allocPage, builtin }) => [[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],[65,0],[34,2],[34,3],[65,1],[54,1,0],[32,3],[65,46],[59,0,4],[32,2],[32,0],[59,0,4],[32,2],[65,2],[15]],
1172
1210
  params: [127,127],
@@ -1449,7 +1487,7 @@ export const BuiltinFuncs = function() {
1449
1487
  locals: [127],
1450
1488
  localNames: ["_this","_this#type","#last_type"],
1451
1489
  };
1452
- this.__String_prototype_valueOf = {
1490
+ this.__String_prototype_toString = {
1453
1491
  wasm: (scope, { allocPage, builtin }) => [[32,0],[65,2],[15]],
1454
1492
  params: [127,127],
1455
1493
  typedParams: true,
@@ -1458,7 +1496,7 @@ export const BuiltinFuncs = function() {
1458
1496
  locals: [],
1459
1497
  localNames: ["_this","_this#type"],
1460
1498
  };
1461
- this.__ByteString_prototype_valueOf = {
1499
+ this.__ByteString_prototype_toString = {
1462
1500
  wasm: (scope, { allocPage, builtin }) => [[32,0],[65,18],[15]],
1463
1501
  params: [127,127],
1464
1502
  typedParams: true,
@@ -1467,51 +1505,22 @@ export const BuiltinFuncs = function() {
1467
1505
  locals: [],
1468
1506
  localNames: ["_this","_this#type"],
1469
1507
  };
1470
- this.__Boolean_prototype_toString = {
1471
- wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'bytestring: __Boolean_prototype_toString/out', 'i8') * pageSize, 124),[33,2],[32,0],[252,3],[4,64],[32,2],[252,3],[34,3],[65,4],[54,1,0],[32,3],[65,244,0],[58,0,4],[32,3],[65,242,0],[58,0,5],[32,3],[65,245,0],[58,0,6],[32,3],[65,229,0],[58,0,7],[32,3],[184],[33,2],[5],[32,2],[252,3],[34,3],[65,5],[54,1,0],[32,3],[65,230,0],[58,0,4],[32,3],[65,225,0],[58,0,5],[32,3],[65,236,0],[58,0,6],[32,3],[65,243,0],[58,0,7],[32,3],[65,229,0],[58,0,8],[32,3],[184],[33,2],[11],[32,2],[65,18],[15]],
1472
- params: [124,127],
1473
- typedParams: true,
1474
- returns: [124,127],
1475
- typedReturns: true,
1476
- locals: [124,127],
1477
- localNames: ["_this","_this#type","out","#makearray_pointer_tmp"],
1478
- };
1479
- this.__String_prototype_toString = {
1480
- wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'string: __String_prototype_toString/out', 'i16') * pageSize, 124),[33,2],[32,0],[32,2],[16, builtin('__Porffor_clone')],[32,2],[65,2],[15]],
1481
- params: [124,127],
1482
- typedParams: true,
1483
- returns: [124,127],
1484
- typedReturns: true,
1485
- locals: [124],
1486
- localNames: ["_this","_this#type","out"],
1487
- };
1488
- this.__ByteString_prototype_toString = {
1489
- wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'bytestring: __ByteString_prototype_toString/out', 'i8') * pageSize, 124),[33,2],[32,0],[32,2],[16, builtin('__Porffor_clone')],[32,2],[65,18],[15]],
1490
- params: [124,127],
1491
- typedParams: true,
1492
- returns: [124,127],
1493
- typedReturns: true,
1494
- locals: [124],
1495
- localNames: ["_this","_this#type","out"],
1496
- };
1497
- this.__Object_prototype_toString = {
1498
- wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'bytestring: __Object_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,18],[15]],
1499
- params: [124,127],
1508
+ this.__String_prototype_valueOf = {
1509
+ wasm: (scope, { allocPage, builtin }) => [[32,0],[65,2],[15]],
1510
+ params: [127,127],
1500
1511
  typedParams: true,
1501
- returns: [124,127],
1512
+ returns: [127,127],
1502
1513
  typedReturns: true,
1503
- locals: [124],
1504
- localNames: ["_this","_this#type","out"],
1505
- data: [{"offset":0,"bytes":[15,0,0,0,91,111,98,106,101,99,116,32,79,98,106,101,99,116,93]}],
1514
+ locals: [],
1515
+ localNames: ["_this","_this#type"],
1506
1516
  };
1507
- this.__Function_prototype_toString = {
1508
- wasm: (scope, { allocPage, builtin }) => [...number(allocPage(scope, 'bytestring: __Function_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,18],[15]],
1509
- params: [124,127],
1517
+ this.__ByteString_prototype_valueOf = {
1518
+ wasm: (scope, { allocPage, builtin }) => [[32,0],[65,18],[15]],
1519
+ params: [127,127],
1510
1520
  typedParams: true,
1511
- returns: [124,127],
1521
+ returns: [127,127],
1512
1522
  typedReturns: true,
1513
- locals: [124],
1514
- localNames: ["_this","_this#type","out"],
1515
- data: [{"offset":0,"bytes":[14,0,0,0,102,117,110,99,116,105,111,110,32,40,41,32,123,125]}],
1523
+ locals: [],
1524
+ localNames: ["_this","_this#type"],
1516
1525
  };
1517
1526
  };
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.2.0-e69a2a2",
4
+ "version": "0.2.0-edb06b8",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -1,45 +0,0 @@
1
- // // @porf --funsafe-no-unlikely-proto-checks --valtype=i32
2
-
3
- export const __Boolean_prototype_toString = (_this: boolean) => {
4
- let out: bytestring = '';
5
- if (_this) out = 'true';
6
- else out = 'false';
7
-
8
- return out;
9
- };
10
-
11
- export const __String_prototype_toString = (_this: string) => {
12
- let out: string = Porffor.s``;
13
- Porffor.clone(_this, out);
14
- return out;
15
- };
16
-
17
- export const __ByteString_prototype_toString = (_this: bytestring) => {
18
- let out: bytestring = Porffor.bs``;
19
- Porffor.clone(_this, out);
20
- return out;
21
- };
22
-
23
- // // export const __undefined_prototype_toString = (_this: number) => {
24
-
25
- // // };
26
-
27
- export const __Object_prototype_toString = (_this: object) => {
28
- let out: bytestring = '[object Object]';
29
- return out;
30
- };
31
-
32
- export const __Function_prototype_toString = (_this: Function) => {
33
- // todo: actually use source
34
- let out: bytestring = 'function () {}';
35
- return out;
36
- };
37
-
38
-
39
- // // export const __Array_prototype_toString = (_this: any[]) => {
40
- // // return _this.join();
41
- // // };
42
-
43
- // // export const __RegExp_prototype_toString = (_this: number) => {
44
-
45
- // // };