porffor 0.2.0-a6c01f5 → 0.2.0-a88bbe6

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,4 +1,4 @@
1
- // @porf -funsafe-no-unlikely-proto-checks -valtype=i32
1
+ // @porf --valtype=i32
2
2
 
3
3
  import type {} from './porffor';
4
4
 
@@ -13,7 +13,7 @@ export const escape = (input: string|bytestring): bytestring => {
13
13
 
14
14
  let i: i32 = Porffor.wasm`local.get ${input}`;
15
15
 
16
- if (Porffor.wasm`local.get ${input+1}` == Porffor.TYPES._bytestring) {
16
+ if (Porffor.wasm`local.get ${input+1}` == Porffor.TYPES.bytestring) {
17
17
  const endPtr: i32 = i + len;
18
18
  while (i < endPtr) {
19
19
  const chr: i32 = Porffor.wasm.i32.load8_u(i++, 0, 4);
@@ -0,0 +1,5 @@
1
+ export const __Function_prototype_toString = (_this: Function) => {
2
+ // todo: actually use source
3
+ let out: bytestring = 'function () {}';
4
+ return out;
5
+ };
@@ -1,5 +1,3 @@
1
- // @porf -funsafe-no-unlikely-proto-checks
2
-
3
1
  // radix: number|any for rawType check
4
2
  // export const parseInt = (input: string|bytestring, radix: number|any): f64 => {
5
3
  export const parseInt = (input: string|bytestring, radix: number): f64 => {
@@ -17,7 +15,7 @@ export const parseInt = (input: string|bytestring, radix: number): f64 => {
17
15
  let nMax: f64 = 58;
18
16
  if (radix < 10) nMax = 48 + radix;
19
17
 
20
- // if (Porffor.rawType(input) == Porffor.TYPES._bytestring) input = ___bytestring_prototype_trimStart(input);
18
+ // if (Porffor.rawType(input) == Porffor.TYPES.bytestring) input = __ByteString_prototype_trimStart(input);
21
19
  // else input = __String_prototype_trimStart(input);
22
20
 
23
21
  let n: f64 = NaN;
@@ -28,7 +26,7 @@ export const parseInt = (input: string|bytestring, radix: number): f64 => {
28
26
 
29
27
  let negative: boolean = false;
30
28
 
31
- if (Porffor.rawType(input) == Porffor.TYPES._bytestring) {
29
+ if (Porffor.rawType(input) == Porffor.TYPES.bytestring) {
32
30
  const endPtr: f64 = i + len;
33
31
 
34
32
  // check start of string
@@ -1,5 +1,3 @@
1
- // // @porf -funsafe-no-unlikely-proto-checks
2
-
3
1
  // radix: number|any for rawType check
4
2
  export const __Number_prototype_toString = (_this: number, radix: number|any) => {
5
3
  let out: bytestring = '';
@@ -20,8 +18,7 @@ export const __Number_prototype_toString = (_this: number, radix: number|any) =>
20
18
 
21
19
  radix |= 0;
22
20
  if (radix < 2 || radix > 36) {
23
- // todo: throw RangeError: toString() radix argument must be between 2 and 36
24
- return out;
21
+ throw new RangeError('toString() radix argument must be between 2 and 36');
25
22
  }
26
23
 
27
24
  if (_this == 0) {
@@ -254,8 +251,7 @@ export const __Number_prototype_toFixed = (_this: number, fractionDigits: number
254
251
 
255
252
  fractionDigits |= 0;
256
253
  if (fractionDigits < 0 || fractionDigits > 100) {
257
- // todo: throw RangeError: toFixed() digits argument must be between 0 and 100
258
- return out;
254
+ throw new RangeError('toFixed() fractionDigits argument must be between 0 and 100');
259
255
  }
260
256
 
261
257
  // if negative value
@@ -349,8 +345,7 @@ export const __Number_prototype_toExponential = (_this: number, fractionDigits:
349
345
  } else {
350
346
  fractionDigits |= 0;
351
347
  if (fractionDigits < 0 || fractionDigits > 100) {
352
- // todo: throw RangeError: toExponential() digits argument must be between 0 and 100
353
- return out;
348
+ throw new RangeError('toExponential() fractionDigits argument must be between 0 and 100');
354
349
  }
355
350
  }
356
351
 
@@ -524,4 +519,11 @@ export const __Number_prototype_toExponential = (_this: number, fractionDigits:
524
519
  out.length = outPtr - Porffor.wasm`local.get ${out}`;
525
520
 
526
521
  return out;
527
- };
522
+ };
523
+
524
+ // 21.1.3.7 Number.prototype.valueOf ()
525
+ // https://tc39.es/ecma262/#sec-number.prototype.valueof
526
+ export const __Number_prototype_valueOf = (_this: number) => {
527
+ // 1. Return ? ThisNumberValue(this value).
528
+ return _this;
529
+ };
@@ -0,0 +1,4 @@
1
+ export const __Object_prototype_toString = (_this: object) => {
2
+ let out: bytestring = '[object Object]';
3
+ return out;
4
+ };
@@ -7,23 +7,41 @@ type PorfforGlobal = {
7
7
  wasm: {
8
8
  (...args: any[]): any;
9
9
  i32: {
10
- or(a: i32, b: i32): i32;
11
-
12
10
  load(pointer: i32, align: i32, offset: i32): i32;
13
11
  store(pointer: i32, value: i32, align: i32, offset: i32): i32;
14
12
  load8_u(pointer: i32, align: i32, offset: i32): i32;
15
13
  store8(pointer: i32, value: i32, align: i32, offset: i32): i32;
16
14
  load16_u(pointer: i32, align: i32, offset: i32): i32;
17
15
  store16(pointer: i32, value: i32, align: i32, offset: i32): i32;
16
+ const(value: i32): i32;
17
+ }
18
+
19
+ f64: {
20
+ load(pointer: i32, align: i32, offset: i32): i32;
21
+ store(pointer: i32, value: f64, align: i32, offset: i32): f64;
18
22
  }
19
23
  }
20
24
 
21
- // randomInt(): i32;
22
25
  randomByte(): i32;
23
26
 
24
27
  type(x: any): bytestring;
25
28
  rawType(x: any): i32;
26
- TYPES: Record<string, i32>;
29
+ TYPES: {
30
+ number: i32;
31
+ boolean: i32;
32
+ string: i32;
33
+ undefined: i32;
34
+ object: i32;
35
+ function: i32;
36
+ symbol: i32;
37
+ bigint: i32;
38
+
39
+ array: i32;
40
+ regexp: i32;
41
+ bytestring: i32;
42
+ date: i32;
43
+ set: i32;
44
+ }
27
45
 
28
46
  fastOr(...args: any): boolean;
29
47
  fastAnd(...args: any): boolean;
@@ -0,0 +1,188 @@
1
+ // dark wasm magic for dealing with memory, sorry.
2
+ export const __Porffor_allocate = (): number => {
3
+ Porffor.wasm`i32.const 1
4
+ memory.grow 0
5
+ drop
6
+ memory.size 0
7
+ i32.const 1
8
+ i32.sub
9
+ i32.const 65536
10
+ i32.mul
11
+ i32.from_u
12
+ return`;
13
+ };
14
+
15
+ export const __Porffor_set_read = (_this: Set, index: number): any => {
16
+ Porffor.wasm`
17
+ local offset i32
18
+ local.get ${index}
19
+ i32.to_u
20
+ i32.const 9
21
+ i32.mul
22
+ local.get ${_this}
23
+ i32.to_u
24
+ i32.add
25
+ local.set offset
26
+
27
+ local.get offset
28
+ f64.load 0 4
29
+
30
+ local.get offset
31
+ i32.load8_u 0 12
32
+ return`;
33
+ };
34
+
35
+ export const __Porffor_set_write = (_this: Set, index: number, value: any): boolean => {
36
+ Porffor.wasm`
37
+ local offset i32
38
+ local.get ${index}
39
+ i32.to_u
40
+ i32.const 9
41
+ i32.mul
42
+ local.get ${_this}
43
+ i32.to_u
44
+ i32.add
45
+ local.set offset
46
+
47
+ local.get offset
48
+ local.get ${value}
49
+ f64.store 0 4
50
+
51
+ local.get offset
52
+ local.get ${value+1}
53
+ i32.store8 0 12`;
54
+
55
+ return true;
56
+ };
57
+
58
+
59
+ // todo: this should be a getter somehow not a method
60
+ export const __Set_prototype_size = (_this: Set) => {
61
+ return Porffor.wasm.i32.load(_this, 0, 0);
62
+ };
63
+
64
+ export const __Set_prototype_values = (_this: Set) => {
65
+ // todo: this should return an iterator not array
66
+ const size: number = __Set_prototype_size(_this);
67
+
68
+ const out: any[] = __Porffor_allocate();
69
+ for (let i: number = 0; i < size; i++) {
70
+ const val: any = __Porffor_set_read(_this, i);
71
+ out.push(val);
72
+ }
73
+
74
+ return out;
75
+ };
76
+
77
+ export const __Set_prototype_keys = (_this: Set) => {
78
+ return __Set_prototype_values(_this);
79
+ };
80
+
81
+ export const __Set_prototype_has = (_this: Set, value: any) => {
82
+ const size: number = __Set_prototype_size(_this);
83
+
84
+ for (let i: number = 0; i < size; i++) {
85
+ if (__Porffor_set_read(_this, i) === value) return true;
86
+ }
87
+
88
+ return false;
89
+ };
90
+
91
+ export const __Set_prototype_add = (_this: Set, value: any) => {
92
+ const size: number = __Set_prototype_size(_this);
93
+
94
+ // check if already in set
95
+ for (let i: number = 0; i < size; i++) {
96
+ if (__Porffor_set_read(_this, i) === value) return _this;
97
+ }
98
+
99
+ // not, add it
100
+ // increment size by 1
101
+ Porffor.wasm.i32.store(_this, size + 1, 0, 0);
102
+
103
+ // write new value at end
104
+ __Porffor_set_write(_this, size, value);
105
+
106
+ return _this;
107
+ };
108
+
109
+ export const __Set_prototype_delete = (_this: Set, value: any) => {
110
+ const size: number = __Set_prototype_size(_this);
111
+
112
+ // check if already in set
113
+ for (let i: number = 0; i < size; i++) {
114
+ if (__Porffor_set_read(_this, i) === value) {
115
+ // found, remove
116
+ // decrement size by 1
117
+ Porffor.wasm.i32.store(_this, size - 1, 0, 0);
118
+
119
+ // offset all elements after by -1 ind
120
+ Porffor.wasm`
121
+ local offset i32
122
+ local.get ${i}
123
+ i32.to_u
124
+ i32.const 9
125
+ i32.mul
126
+ local.get ${_this}
127
+ i32.to_u
128
+ i32.add
129
+ i32.const 4
130
+ i32.add
131
+ local.set offset
132
+
133
+ ;; dst = offset (this element)
134
+ local.get offset
135
+
136
+ ;; src = offset + 9 (this element + 1 element)
137
+ local.get offset
138
+ i32.const 9
139
+ i32.add
140
+
141
+ ;; size = (size - i - 1) * 9
142
+ local.get ${size}
143
+ local.get ${i}
144
+ f64.sub
145
+ i32.to_u
146
+ i32.const 1
147
+ i32.sub
148
+ i32.const 9
149
+ i32.mul
150
+
151
+ memory.copy 0 0
152
+ `;
153
+
154
+ return true;
155
+ }
156
+ }
157
+
158
+ // not, return false
159
+ return false;
160
+ };
161
+
162
+ export const __Set_prototype_clear = (_this: Set) => {
163
+ // just set size to 0
164
+ // do not need to remove as will not be accessed anymore,
165
+ // and will be overwritten with new add
166
+ Porffor.wasm.i32.store(_this, 0, 0, 0);
167
+ };
168
+
169
+ export const Set = () => {
170
+ throw new TypeError("Constructor Set requires 'new'");
171
+ };
172
+
173
+ export const Set$constructor = (iterable: any): Set => {
174
+ const out: Set = __Porffor_allocate();
175
+
176
+ const type: number = Porffor.rawType(iterable);
177
+ if (Porffor.fastOr(
178
+ type == Porffor.TYPES.array,
179
+ type == Porffor.TYPES.string, type == Porffor.TYPES.bytestring,
180
+ type == Porffor.TYPES.set
181
+ )) {
182
+ for (const x of iterable) {
183
+ __Set_prototype_add(out, x);
184
+ }
185
+ }
186
+
187
+ return out;
188
+ };
@@ -1,4 +1,4 @@
1
- // @porf -funsafe-no-unlikely-proto-checks -valtype=i32
1
+ // @porf --valtype=i32
2
2
 
3
3
  export const __String_fromCharCode = (code: i32) => {
4
4
  // todo: support >1 arg
@@ -37,7 +37,7 @@ export const __String_prototype_toUpperCase = (_this: string) => {
37
37
  return out;
38
38
  };
39
39
 
40
- export const ___bytestring_prototype_toUpperCase = (_this: bytestring) => {
40
+ export const __ByteString_prototype_toUpperCase = (_this: bytestring) => {
41
41
  const len: i32 = _this.length;
42
42
 
43
43
  let out: bytestring = '';
@@ -83,7 +83,7 @@ export const __String_prototype_toLowerCase = (_this: string) => {
83
83
  return out;
84
84
  };
85
85
 
86
- export const ___bytestring_prototype_toLowerCase = (_this: bytestring) => {
86
+ export const __ByteString_prototype_toLowerCase = (_this: bytestring) => {
87
87
  const len: i32 = _this.length;
88
88
 
89
89
  let out: bytestring = '';
@@ -134,10 +134,10 @@ export const __String_prototype_startsWith = (_this: string, searchString: strin
134
134
  return true;
135
135
  };
136
136
 
137
- export const ___bytestring_prototype_startsWith = (_this: bytestring, searchString: bytestring, position: number) => {
137
+ export const __ByteString_prototype_startsWith = (_this: bytestring, searchString: bytestring, position: number) => {
138
138
  // if searching non-bytestring, bytestring will not start with it
139
139
  // todo: change this to just check if = string and ToString others
140
- if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES._bytestring) return false;
140
+ if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES.bytestring) return false;
141
141
 
142
142
  // todo/perf: investigate whether for counter vs while ++s are faster
143
143
 
@@ -204,10 +204,10 @@ export const __String_prototype_endsWith = (_this: string, searchString: string,
204
204
  return true;
205
205
  };
206
206
 
207
- export const ___bytestring_prototype_endsWith = (_this: bytestring, searchString: bytestring, endPosition: number) => {
207
+ export const __ByteString_prototype_endsWith = (_this: bytestring, searchString: bytestring, endPosition: number) => {
208
208
  // if searching non-bytestring, bytestring will not start with it
209
209
  // todo: change this to just check if = string and ToString others
210
- if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES._bytestring) return false;
210
+ if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES.bytestring) return false;
211
211
 
212
212
  let i: i32 = Porffor.wasm`local.get ${_this}`,
213
213
  j: i32 = Porffor.wasm`local.get ${searchString}`;
@@ -282,10 +282,10 @@ export const __String_prototype_indexOf = (_this: string, searchString: string,
282
282
  return -1;
283
283
  };
284
284
 
285
- export const ___bytestring_prototype_indexOf = (_this: bytestring, searchString: bytestring, position: number) => {
285
+ export const __ByteString_prototype_indexOf = (_this: bytestring, searchString: bytestring, position: number) => {
286
286
  // if searching non-bytestring, bytestring will not start with it
287
287
  // todo: change this to just check if = string and ToString others
288
- if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES._bytestring) return -1;
288
+ if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES.bytestring) return -1;
289
289
 
290
290
  let thisPtr: i32 = Porffor.wasm`local.get ${_this}`;
291
291
  const searchPtr: i32 = Porffor.wasm`local.get ${searchString}`;
@@ -369,10 +369,10 @@ export const __String_prototype_lastIndexOf = (_this: string, searchString: stri
369
369
  return -1;
370
370
  };
371
371
 
372
- export const ___bytestring_prototype_lastIndexOf = (_this: bytestring, searchString: bytestring, position: number) => {
372
+ export const __ByteString_prototype_lastIndexOf = (_this: bytestring, searchString: bytestring, position: number) => {
373
373
  // if searching non-bytestring, bytestring will not start with it
374
374
  // todo: change this to just check if = string and ToString others
375
- if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES._bytestring) return -1;
375
+ if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES.bytestring) return -1;
376
376
 
377
377
  let thisPtr: i32 = Porffor.wasm`local.get ${_this}`;
378
378
  const searchPtr: i32 = Porffor.wasm`local.get ${searchString}`;
@@ -455,10 +455,10 @@ export const __String_prototype_includes = (_this: string, searchString: string,
455
455
  return false;
456
456
  };
457
457
 
458
- export const ___bytestring_prototype_includes = (_this: bytestring, searchString: bytestring, position: number) => {
458
+ export const __ByteString_prototype_includes = (_this: bytestring, searchString: bytestring, position: number) => {
459
459
  // if searching non-bytestring, bytestring will not start with it
460
460
  // todo: change this to just check if = string and ToString others
461
- if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES._bytestring) return -1;
461
+ if (Porffor.wasm`local.get ${searchString+1}` != Porffor.TYPES.bytestring) return -1;
462
462
 
463
463
  let thisPtr: i32 = Porffor.wasm`local.get ${_this}`;
464
464
  const searchPtr: i32 = Porffor.wasm`local.get ${searchString}`;
@@ -542,7 +542,7 @@ export const __String_prototype_padStart = (_this: string, targetLength: number,
542
542
  return out;
543
543
  };
544
544
 
545
- export const ___bytestring_prototype_padStart = (_this: bytestring, targetLength: number, padString: bytestring) => {
545
+ export const __ByteString_prototype_padStart = (_this: bytestring, targetLength: number, padString: bytestring) => {
546
546
  // todo: handle padString being non-bytestring
547
547
 
548
548
  let out: bytestring = Porffor.bs``;
@@ -631,7 +631,7 @@ export const __String_prototype_padEnd = (_this: string, targetLength: number, p
631
631
  return out;
632
632
  };
633
633
 
634
- export const ___bytestring_prototype_padEnd = (_this: bytestring, targetLength: number, padString: bytestring) => {
634
+ export const __ByteString_prototype_padEnd = (_this: bytestring, targetLength: number, padString: bytestring) => {
635
635
  // todo: handle padString being non-bytestring
636
636
 
637
637
  let out: bytestring = Porffor.bs``;
@@ -713,7 +713,7 @@ export const __String_prototype_substring = (_this: string, start: number, end:
713
713
  return out;
714
714
  };
715
715
 
716
- export const ___bytestring_prototype_substring = (_this: bytestring, start: number, end: number) => {
716
+ export const __ByteString_prototype_substring = (_this: bytestring, start: number, end: number) => {
717
717
  const len: i32 = _this.length;
718
718
  if (Porffor.wasm`local.get ${end+1}` == Porffor.TYPES.undefined) end = len;
719
719
  else if (start > end) {
@@ -786,7 +786,7 @@ export const __String_prototype_substr = (_this: string, start: number, length:
786
786
  return out;
787
787
  };
788
788
 
789
- export const ___bytestring_prototype_substr = (_this: string, start: number, length: number) => {
789
+ export const __ByteString_prototype_substr = (_this: string, start: number, length: number) => {
790
790
  const len: i32 = _this.length;
791
791
 
792
792
  start |= 0;
@@ -862,7 +862,7 @@ export const __String_prototype_slice = (_this: string, start: number, end: numb
862
862
  return out;
863
863
  };
864
864
 
865
- export const ___bytestring_prototype_slice = (_this: bytestring, start: number, end: number) => {
865
+ export const __ByteString_prototype_slice = (_this: bytestring, start: number, end: number) => {
866
866
  const len: i32 = _this.length;
867
867
  if (Porffor.wasm`local.get ${end+1}` == Porffor.TYPES.undefined) end = len;
868
868
 
@@ -935,7 +935,7 @@ export const __String_prototype_trimStart = (_this: string) => {
935
935
  return out;
936
936
  };
937
937
 
938
- export const ___bytestring_prototype_trimStart = (_this: bytestring) => {
938
+ export const __ByteString_prototype_trimStart = (_this: bytestring) => {
939
939
  let out: bytestring = Porffor.bs``;
940
940
 
941
941
  let outPtr: i32 = Porffor.wasm`local.get ${out}`;
@@ -1006,7 +1006,7 @@ export const __String_prototype_trimEnd = (_this: string) => {
1006
1006
  return out;
1007
1007
  };
1008
1008
 
1009
- export const ___bytestring_prototype_trimEnd = (_this: bytestring) => {
1009
+ export const __ByteString_prototype_trimEnd = (_this: bytestring) => {
1010
1010
  let out: bytestring = Porffor.bs``;
1011
1011
 
1012
1012
  let outPtr: i32 = Porffor.wasm`local.get ${out}`;
@@ -1049,7 +1049,32 @@ export const __String_prototype_trim = (_this: string) => {
1049
1049
  return __String_prototype_trimStart(__String_prototype_trimEnd(_this));
1050
1050
  };
1051
1051
 
1052
- export const ___bytestring_prototype_trim = (_this: bytestring) => {
1052
+ export const __ByteString_prototype_trim = (_this: bytestring) => {
1053
1053
  // todo/perf: optimize and not just reuse
1054
- return ___bytestring_prototype_trimStart(___bytestring_prototype_trimEnd(_this));
1054
+ return __ByteString_prototype_trimStart(__ByteString_prototype_trimEnd(_this));
1055
+ };
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
+
1069
+
1070
+ // 22.1.3.35 String.prototype.valueOf ()
1071
+ // https://tc39.es/ecma262/#sec-string.prototype.valueof
1072
+ export const __String_prototype_valueOf = (_this: string) => {
1073
+ // 1. Return ? ThisStringValue(this value).
1074
+ return _this;
1075
+ };
1076
+
1077
+ export const __ByteString_prototype_valueOf = (_this: bytestring) => {
1078
+ // 1. Return ? ThisStringValue(this value).
1079
+ return _this;
1055
1080
  };
@@ -141,7 +141,7 @@ export const BuiltinVars = function() {
141
141
 
142
142
  // wintercg(tm)
143
143
  this.__navigator_userAgent = (scope, { makeString }) => makeString(scope, `Porffor/0.2.0`, false, '__navigator_userAgent');
144
- this.__navigator_userAgent.type = Prefs.bytestring ? TYPES._bytestring : TYPES.string;
144
+ this.__navigator_userAgent.type = Prefs.bytestring ? TYPES.bytestring : TYPES.string;
145
145
 
146
146
  for (const x in TYPES) {
147
147
  this['__Porffor_TYPES_' + x] = number(TYPES[x]);
@@ -273,7 +273,7 @@ export const BuiltinFuncs = function() {
273
273
 
274
274
  [ Opcodes.end ]
275
275
  ],
276
- [TYPES._bytestring]: [
276
+ [TYPES.bytestring]: [
277
277
  // simply print a (byte)string :))
278
278
  // cache input pointer as i32
279
279
  [ Opcodes.local_get, 0 ],
@@ -307,7 +307,7 @@ export const BuiltinFuncs = function() {
307
307
 
308
308
  [ Opcodes.end ]
309
309
  ],
310
- [TYPES._array]: [
310
+ [TYPES.array]: [
311
311
  ...printStaticStr('[ '),
312
312
 
313
313
  // cache input pointer as i32
@@ -915,27 +915,6 @@ export const BuiltinFuncs = function() {
915
915
  ]
916
916
  };
917
917
 
918
- // this.__Porffor_randomInt = {
919
- // params: [],
920
- // locals: prng.locals,
921
- // localNames: [ 's1', 's0' ],
922
- // globals: prng.globals,
923
- // globalNames: [ 'state0', 'state1' ],
924
- // globalInits: [ prngSeed0, prngSeed1 ],
925
- // returns: [ Valtype.i32 ],
926
- // wasm: [
927
- // ...prng.wasm,
928
-
929
- // ...(prng.returns === Valtype.i64 ? [
930
- // // the lowest bits of the output generated by xorshift128+ have low quality
931
- // ...number(56, Valtype.i64),
932
- // [ Opcodes.i64_shr_u ],
933
-
934
- // [ Opcodes.i32_wrap_i64 ],
935
- // ] : []),
936
- // ]
937
- // };
938
-
939
918
  this.__Porffor_randomByte = {
940
919
  params: [],
941
920
  locals: prng.locals,
@@ -1060,7 +1039,7 @@ export const BuiltinFuncs = function() {
1060
1039
  typedParams: true,
1061
1040
  locals: [ Valtype.i32, Valtype.i32 ],
1062
1041
  returns: [ valtypeBinary ],
1063
- returnType: Prefs.bytestring ? TYPES._bytestring : TYPES.string,
1042
+ returnType: Prefs.bytestring ? TYPES.bytestring : TYPES.string,
1064
1043
  wasm: (scope, { TYPE_NAMES, typeSwitch, makeString }) => {
1065
1044
  const bc = {};
1066
1045
  for (const x in TYPE_NAMES) {