porffor 0.55.31 → 0.55.33
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/bun.lock +36 -0
- package/compiler/2c.js +3 -4
- package/compiler/builtins/_internal_object.ts +317 -237
- package/compiler/builtins/_internal_string.ts +4 -4
- package/compiler/builtins/annexb_string.js +12 -11
- package/compiler/builtins/array.ts +21 -22
- package/compiler/builtins/arraybuffer.ts +4 -4
- package/compiler/builtins/bigint.ts +4 -4
- package/compiler/builtins/console.ts +9 -9
- package/compiler/builtins/dataview.ts +3 -3
- package/compiler/builtins/date.ts +46 -52
- package/compiler/builtins/error.js +1 -1
- package/compiler/builtins/json.ts +6 -6
- package/compiler/builtins/math.ts +1 -1
- package/compiler/builtins/number.ts +9 -9
- package/compiler/builtins/object.ts +32 -32
- package/compiler/builtins/object_prototypeWithHidden.js +1 -1
- package/compiler/builtins/porffor.d.ts +4 -3
- package/compiler/builtins/promise.ts +6 -6
- package/compiler/builtins/reflect.ts +1 -1
- package/compiler/builtins/set.ts +7 -7
- package/compiler/builtins/string_f64.ts +2 -2
- package/compiler/builtins/symbol.ts +2 -2
- package/compiler/builtins/typedarray.js +7 -7
- package/compiler/builtins/z_ecma262.ts +7 -7
- package/compiler/builtins.js +5 -6
- package/compiler/builtins_objects.js +27 -5
- package/compiler/builtins_precompiled.js +519 -520
- package/compiler/codegen.js +29 -39
- package/compiler/index.js +2 -5
- package/compiler/precompile.js +4 -3
- package/package.json +2 -2
- package/r.cjs +2 -9
- package/runner/index.js +1 -1
- package/compiler/builtins/__internal_object.ts +0 -83
@@ -1,12 +1,11 @@
|
|
1
1
|
export default () => {
|
2
2
|
let out = ``;
|
3
3
|
const noArgs = (a0, a1) => out += `
|
4
|
-
export const __String_prototype_${a0} = (_this: any) =>
|
5
|
-
|
6
|
-
|
4
|
+
export const __String_prototype_${a0} = (_this: any) =>
|
5
|
+
Porffor.concatStrings(
|
6
|
+
Porffor.concatStrings('<${a1}>', _this),
|
7
|
+
'</${a1}>');
|
7
8
|
|
8
|
-
return Porffor.concatStrings(Porffor.concatStrings(pre, _this), post);
|
9
|
-
};
|
10
9
|
export const __ByteString_prototype_${a0} = (_this: any) =>
|
11
10
|
__String_prototype_${a0}(_this);
|
12
11
|
`;
|
@@ -22,13 +21,15 @@ export const __ByteString_prototype_${a0} = (_this: any) =>
|
|
22
21
|
noArgs('sup', 'sup');
|
23
22
|
|
24
23
|
const arg = (name, s1, s2) => out += `
|
25
|
-
export const __String_prototype_${name} = (_this: any, arg: any) =>
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
export const __String_prototype_${name} = (_this: any, arg: any) =>
|
25
|
+
Porffor.concatStrings(
|
26
|
+
Porffor.concatStrings(
|
27
|
+
Porffor.concatStrings(
|
28
|
+
Porffor.concatStrings('<${s1} ${s2}="', arg),
|
29
|
+
'">'),
|
30
|
+
_this),
|
31
|
+
'</${s1}>');
|
29
32
|
|
30
|
-
return Porffor.concatStrings(Porffor.concatStrings(Porffor.concatStrings(Porffor.concatStrings(pre1, arg), pre2), _this), post);
|
31
|
-
};
|
32
33
|
export const __ByteString_prototype_${name} = (_this: any, arg: any) =>
|
33
34
|
__String_prototype_${name}(_this, arg);
|
34
35
|
`;
|
@@ -11,7 +11,7 @@ export const Array = function (...args: any[]): any[] {
|
|
11
11
|
if (argsLen == 1) {
|
12
12
|
// 1 arg, length (number) or first element (non-number)
|
13
13
|
const arg: any = args[0];
|
14
|
-
if (Porffor.
|
14
|
+
if (Porffor.type(arg) == Porffor.TYPES.number) {
|
15
15
|
// number so use as length
|
16
16
|
const n: number = args[0];
|
17
17
|
if (Porffor.fastOr(
|
@@ -33,7 +33,7 @@ export const Array = function (...args: any[]): any[] {
|
|
33
33
|
};
|
34
34
|
|
35
35
|
export const __Array_isArray = (x: unknown): boolean =>
|
36
|
-
Porffor.
|
36
|
+
Porffor.type(x) == Porffor.TYPES.array;
|
37
37
|
|
38
38
|
export const __Array_from = (arg: any, mapFn: any): any[] => {
|
39
39
|
if (arg == null) throw new TypeError('Argument cannot be nullish');
|
@@ -41,7 +41,7 @@ export const __Array_from = (arg: any, mapFn: any): any[] => {
|
|
41
41
|
let out: any[] = Porffor.allocate();
|
42
42
|
let len: i32 = 0;
|
43
43
|
|
44
|
-
const type = Porffor.
|
44
|
+
const type = Porffor.type(arg);
|
45
45
|
if (Porffor.fastOr(
|
46
46
|
type == Porffor.TYPES.array,
|
47
47
|
type == Porffor.TYPES.string, type == Porffor.TYPES.bytestring,
|
@@ -49,8 +49,8 @@ export const __Array_from = (arg: any, mapFn: any): any[] => {
|
|
49
49
|
Porffor.fastAnd(type >= Porffor.TYPES.uint8array, type <= Porffor.TYPES.float64array)
|
50
50
|
)) {
|
51
51
|
let i: i32 = 0;
|
52
|
-
if (Porffor.
|
53
|
-
if (Porffor.
|
52
|
+
if (Porffor.type(mapFn) != Porffor.TYPES.undefined) {
|
53
|
+
if (Porffor.type(mapFn) != Porffor.TYPES.function) throw new TypeError('Called Array.from with a non-function mapFn');
|
54
54
|
|
55
55
|
for (const x of arg) {
|
56
56
|
out[i] = mapFn(x, i);
|
@@ -66,8 +66,7 @@ export const __Array_from = (arg: any, mapFn: any): any[] => {
|
|
66
66
|
}
|
67
67
|
|
68
68
|
if (type == Porffor.TYPES.object) {
|
69
|
-
|
70
|
-
len = ecma262.ToIntegerOrInfinity((arg as object)[lengthKey]);
|
69
|
+
len = ecma262.ToIntegerOrInfinity((arg as object)['length']);
|
71
70
|
if (len > 4294967295) throw new RangeError('Invalid array length');
|
72
71
|
if (len < 0) len = 0;
|
73
72
|
|
@@ -133,7 +132,7 @@ memory.copy 0 0`;
|
|
133
132
|
|
134
133
|
export const __Array_prototype_slice = (_this: any[], _start: any, _end: any) => {
|
135
134
|
const len: i32 = _this.length;
|
136
|
-
if (Porffor.
|
135
|
+
if (Porffor.type(_end) == Porffor.TYPES.undefined) _end = len;
|
137
136
|
|
138
137
|
let start: i32 = ecma262.ToIntegerOrInfinity(_start);
|
139
138
|
let end: i32 = ecma262.ToIntegerOrInfinity(_end);
|
@@ -182,7 +181,7 @@ export const __Array_prototype_splice = (_this: any[], _start: any, _deleteCount
|
|
182
181
|
}
|
183
182
|
if (start > len) start = len;
|
184
183
|
|
185
|
-
if (Porffor.
|
184
|
+
if (Porffor.type(_deleteCount) == Porffor.TYPES.undefined) _deleteCount = len - start;
|
186
185
|
let deleteCount: i32 = ecma262.ToIntegerOrInfinity(_deleteCount);
|
187
186
|
|
188
187
|
if (deleteCount < 0) deleteCount = 0;
|
@@ -273,8 +272,8 @@ memory.copy 0 0`;
|
|
273
272
|
export const __Array_prototype_fill = (_this: any[], value: any, _start: any, _end: any) => {
|
274
273
|
const len: i32 = _this.length;
|
275
274
|
|
276
|
-
if (Porffor.
|
277
|
-
if (Porffor.
|
275
|
+
if (Porffor.type(_start) == Porffor.TYPES.undefined) _start = 0;
|
276
|
+
if (Porffor.type(_end) == Porffor.TYPES.undefined) _end = len;
|
278
277
|
|
279
278
|
let start: i32 = ecma262.ToIntegerOrInfinity(_start);
|
280
279
|
let end: i32 = ecma262.ToIntegerOrInfinity(_end);
|
@@ -393,7 +392,7 @@ export const __Array_prototype_copyWithin = (_this: any[], _target: any, _start:
|
|
393
392
|
if (start > len) start = len;
|
394
393
|
|
395
394
|
let end: i32;
|
396
|
-
if (Porffor.
|
395
|
+
if (Porffor.type(_end) == Porffor.TYPES.undefined) {
|
397
396
|
end = len;
|
398
397
|
} else {
|
399
398
|
end = ecma262.ToIntegerOrInfinity(_end);
|
@@ -420,7 +419,7 @@ export const __Array_prototype_concat = (_this: any[], ...vals: any[]) => {
|
|
420
419
|
let len: i32 = _this.length;
|
421
420
|
|
422
421
|
for (const x of vals) {
|
423
|
-
if (Porffor.
|
422
|
+
if (Porffor.type(x) & 0b01000000) { // value is iterable
|
424
423
|
// todo: for..of is broken here because ??
|
425
424
|
const l: i32 = x.length;
|
426
425
|
for (let i: i32 = 0; i < l; i++) {
|
@@ -498,7 +497,7 @@ export const __Array_prototype_flatMap = (_this: any[], callbackFn: any, thisArg
|
|
498
497
|
let i: i32 = 0, j: i32 = 0;
|
499
498
|
while (i < len) {
|
500
499
|
let x: any = callbackFn.call(thisArg, _this[i], i++, _this);
|
501
|
-
if (Porffor.
|
500
|
+
if (Porffor.type(x) == Porffor.TYPES.array) {
|
502
501
|
for (const y of x) out[j++] = y;
|
503
502
|
} else out[j++] = x;
|
504
503
|
}
|
@@ -647,8 +646,8 @@ export const __Array_prototype_sort = (_this: any[], callbackFn: any) => {
|
|
647
646
|
|
648
647
|
// 23.1.3.30.2 CompareArrayElements (x, y, comparefn)
|
649
648
|
// https://tc39.es/ecma262/#sec-comparearrayelements
|
650
|
-
const xt: i32 = Porffor.
|
651
|
-
const yt: i32 = Porffor.
|
649
|
+
const xt: i32 = Porffor.type(x);
|
650
|
+
const yt: i32 = Porffor.type(y);
|
652
651
|
let v: number;
|
653
652
|
|
654
653
|
// 1. If x and y are both undefined, return +0𝔽.
|
@@ -691,7 +690,7 @@ export const __Array_prototype_toString = (_this: any[]) => {
|
|
691
690
|
if (i > 0) Porffor.bytestring.appendChar(out, 44);
|
692
691
|
|
693
692
|
const element: any = _this[i++];
|
694
|
-
const type: i32 = Porffor.
|
693
|
+
const type: i32 = Porffor.type(element);
|
695
694
|
if (element != 0 || Porffor.fastAnd(
|
696
695
|
type != Porffor.TYPES.undefined, // undefined
|
697
696
|
type != Porffor.TYPES.object // null
|
@@ -713,7 +712,7 @@ export const __Array_prototype_join = (_this: any[], _separator: any) => {
|
|
713
712
|
// todo/perf: optimize default separator (?)
|
714
713
|
|
715
714
|
let separator: bytestring = ',';
|
716
|
-
if (Porffor.
|
715
|
+
if (Porffor.type(_separator) != Porffor.TYPES.undefined)
|
717
716
|
separator = ecma262.ToString(_separator);
|
718
717
|
|
719
718
|
let out: bytestring = Porffor.allocate();
|
@@ -723,7 +722,7 @@ export const __Array_prototype_join = (_this: any[], _separator: any) => {
|
|
723
722
|
if (i > 0) Porffor.bytestring.appendStr(out, separator);
|
724
723
|
|
725
724
|
const element: any = _this[i++];
|
726
|
-
const type: i32 = Porffor.
|
725
|
+
const type: i32 = Porffor.type(element);
|
727
726
|
if (element != 0 || Porffor.fastAnd(
|
728
727
|
type != Porffor.TYPES.undefined, // undefined
|
729
728
|
type != Porffor.TYPES.object // null
|
@@ -781,7 +780,7 @@ export const __Array_prototype_toSpliced = (_this: any[], _start: any, _deleteCo
|
|
781
780
|
}
|
782
781
|
if (start > len) start = len;
|
783
782
|
|
784
|
-
if (Porffor.
|
783
|
+
if (Porffor.type(_deleteCount) == Porffor.TYPES.undefined) _deleteCount = len - start;
|
785
784
|
let deleteCount: i32 = ecma262.ToIntegerOrInfinity(_deleteCount);
|
786
785
|
|
787
786
|
if (deleteCount < 0) deleteCount = 0;
|
@@ -854,7 +853,7 @@ memory.copy 0 0`;
|
|
854
853
|
|
855
854
|
|
856
855
|
export const __Array_prototype_flat = (_this: any[], _depth: any) => {
|
857
|
-
if (Porffor.
|
856
|
+
if (Porffor.type(_depth) == Porffor.TYPES.undefined) _depth = 1;
|
858
857
|
let depth: i32 = ecma262.ToIntegerOrInfinity(_depth);
|
859
858
|
|
860
859
|
let out: any[] = Porffor.allocate();
|
@@ -867,7 +866,7 @@ export const __Array_prototype_flat = (_this: any[], _depth: any) => {
|
|
867
866
|
let i: i32 = 0, j: i32 = 0;
|
868
867
|
while (i < len) {
|
869
868
|
let x: any = _this[i++];
|
870
|
-
if (Porffor.
|
869
|
+
if (Porffor.type(x) == Porffor.TYPES.array) {
|
871
870
|
if (depth > 1) x = __Array_prototype_flat(x, depth - 1);
|
872
871
|
for (const y of x) out[j++] = y;
|
873
872
|
} else out[j++] = x;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type {} from './porffor.d.ts';
|
2
2
|
|
3
3
|
export const __ArrayBuffer_isView = (value: any): boolean => {
|
4
|
-
const t: i32 = Porffor.
|
4
|
+
const t: i32 = Porffor.type(value);
|
5
5
|
if (Porffor.fastOr(
|
6
6
|
t == Porffor.TYPES.dataview,
|
7
7
|
Porffor.fastAnd(t >= Porffor.TYPES.uint8array, t <= Porffor.TYPES.float64array)
|
@@ -84,7 +84,7 @@ export const __ArrayBuffer_prototype_slice = (_this: ArrayBuffer, start: any, en
|
|
84
84
|
if (_this.detached) throw new TypeError('Called ArrayBuffer.prototype.slice on a detached ArrayBuffer');
|
85
85
|
|
86
86
|
const len: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
87
|
-
if (Porffor.
|
87
|
+
if (Porffor.type(end) == Porffor.TYPES.undefined) end = len;
|
88
88
|
|
89
89
|
start = ecma262.ToIntegerOrInfinity(start);
|
90
90
|
end = ecma262.ToIntegerOrInfinity(end);
|
@@ -136,7 +136,7 @@ export const __ArrayBuffer_prototype_transfer = (_this: ArrayBuffer, newLength:
|
|
136
136
|
if (_this.detached) throw new TypeError('Called ArrayBuffer.prototype.transfer on a detached ArrayBuffer');
|
137
137
|
|
138
138
|
const len: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
139
|
-
if (Porffor.
|
139
|
+
if (Porffor.type(newLength) == Porffor.TYPES.undefined) newLength = len;
|
140
140
|
|
141
141
|
// make new arraybuffer
|
142
142
|
const out: ArrayBuffer = new ArrayBuffer(newLength);
|
@@ -208,7 +208,7 @@ export const __SharedArrayBuffer_prototype_growable$get = (_this: SharedArrayBuf
|
|
208
208
|
|
209
209
|
export const __SharedArrayBuffer_prototype_slice = (_this: SharedArrayBuffer, start: any, end: any) => {
|
210
210
|
const len: i32 = Porffor.wasm.i32.load(_this, 0, 0);
|
211
|
-
if (Porffor.
|
211
|
+
if (Porffor.type(end) == Porffor.TYPES.undefined) end = len;
|
212
212
|
|
213
213
|
start = ecma262.ToIntegerOrInfinity(start);
|
214
214
|
end = ecma262.ToIntegerOrInfinity(end);
|
@@ -280,16 +280,16 @@ export const __ecma262_ToBigInt = (argument: any): bigint => {
|
|
280
280
|
// Table 12: BigInt Conversions
|
281
281
|
// Argument Type Result
|
282
282
|
// BigInt Return prim.
|
283
|
-
if (Porffor.
|
283
|
+
if (Porffor.type(prim) == Porffor.TYPES.bigint) return prim;
|
284
284
|
|
285
285
|
// String
|
286
286
|
// 1. Let n be StringToBigInt(prim).
|
287
287
|
// 2. If n is undefined, throw a SyntaxError exception.
|
288
288
|
// 3. Return n.
|
289
|
-
if ((Porffor.
|
289
|
+
if ((Porffor.type(prim) | 0b10000000) == Porffor.TYPES.bytestring) return __Porffor_bigint_fromString(prim);
|
290
290
|
|
291
291
|
// Boolean Return 1n if prim is true and 0n if prim is false.
|
292
|
-
if (Porffor.
|
292
|
+
if (Porffor.type(prim) == Porffor.TYPES.boolean) return prim ? 1n : 0n;
|
293
293
|
|
294
294
|
// Number Throw a TypeError exception.
|
295
295
|
// Symbol Throw a TypeError exception.
|
@@ -306,7 +306,7 @@ export const BigInt = (value: any): bigint => {
|
|
306
306
|
const prim: any = ecma262.ToPrimitive.Number(value);
|
307
307
|
|
308
308
|
// 3. If prim is a Number, return ? NumberToBigInt(prim).
|
309
|
-
if (Porffor.
|
309
|
+
if (Porffor.type(prim) == Porffor.TYPES.number) return __Porffor_bigint_fromNumber(prim);
|
310
310
|
|
311
311
|
// 4. Otherwise, return ? ToBigInt(prim).
|
312
312
|
return __ecma262_ToBigInt(prim);
|
@@ -2,7 +2,7 @@ import type {} from './porffor.d.ts';
|
|
2
2
|
|
3
3
|
export const __Porffor_printString = (arg: bytestring|string) => {
|
4
4
|
let ptr: i32 = Porffor.wasm`local.get ${arg}`;
|
5
|
-
if (Porffor.
|
5
|
+
if (Porffor.type(arg) == Porffor.TYPES.bytestring) {
|
6
6
|
const end: i32 = ptr + arg.length;
|
7
7
|
while (ptr < end) {
|
8
8
|
printChar(Porffor.wasm.i32.load8_u(ptr++, 0, 4));
|
@@ -35,7 +35,7 @@ export const __Porffor_numberLog = (arg: number) => {
|
|
35
35
|
};
|
36
36
|
|
37
37
|
export const __Porffor_miniLog = (arg: any) => {
|
38
|
-
switch (Porffor.
|
38
|
+
switch (Porffor.type(arg)) {
|
39
39
|
case Porffor.TYPES.number:
|
40
40
|
print(arg);
|
41
41
|
break;
|
@@ -111,7 +111,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true, depth: number
|
|
111
111
|
}
|
112
112
|
};
|
113
113
|
|
114
|
-
switch (Porffor.
|
114
|
+
switch (Porffor.type(arg)) {
|
115
115
|
case Porffor.TYPES.number:
|
116
116
|
if (colors) Porffor.printStatic('\x1b[33m'); // yellow
|
117
117
|
print(arg);
|
@@ -248,7 +248,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true, depth: number
|
|
248
248
|
|
249
249
|
case Porffor.TYPES.sharedarraybuffer:
|
250
250
|
case Porffor.TYPES.arraybuffer:
|
251
|
-
if (Porffor.
|
251
|
+
if (Porffor.type(arg) == Porffor.TYPES.sharedarraybuffer) Porffor.printStatic('SharedArrayBuffer');
|
252
252
|
else Porffor.printStatic('ArrayBuffer');
|
253
253
|
Porffor.printStatic(' {\n');
|
254
254
|
|
@@ -286,7 +286,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true, depth: number
|
|
286
286
|
|
287
287
|
case Porffor.TYPES.weakmap:
|
288
288
|
case Porffor.TYPES.map:
|
289
|
-
if (Porffor.
|
289
|
+
if (Porffor.type(arg) == Porffor.TYPES.weakmap) Porffor.printStatic('WeakMap');
|
290
290
|
else Porffor.printStatic('Map');
|
291
291
|
Porffor.printStatic('(');
|
292
292
|
|
@@ -308,7 +308,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true, depth: number
|
|
308
308
|
|
309
309
|
case Porffor.TYPES.weakset:
|
310
310
|
case Porffor.TYPES.set:
|
311
|
-
if (Porffor.
|
311
|
+
if (Porffor.type(arg) == Porffor.TYPES.weakset) Porffor.printStatic('WeakSet');
|
312
312
|
else Porffor.printStatic('Set');
|
313
313
|
Porffor.printStatic('(');
|
314
314
|
|
@@ -351,7 +351,7 @@ export const __console_clear = () => {
|
|
351
351
|
};
|
352
352
|
|
353
353
|
export const __Porffor_consolePrint = (arg: any) => {
|
354
|
-
if (Porffor.fastOr(Porffor.
|
354
|
+
if (Porffor.fastOr(Porffor.type(arg) == Porffor.TYPES.bytestring, Porffor.type(arg) == Porffor.TYPES.string)) {
|
355
355
|
__Porffor_printString(arg);
|
356
356
|
return;
|
357
357
|
}
|
@@ -359,7 +359,7 @@ export const __Porffor_consolePrint = (arg: any) => {
|
|
359
359
|
};
|
360
360
|
|
361
361
|
export const __console_group = (label: bytestring) => {
|
362
|
-
if (Porffor.
|
362
|
+
if (Porffor.type(label) != Porffor.TYPES.undefined) {
|
363
363
|
__Porffor_consoleIndent();
|
364
364
|
__Porffor_consolePrint(label);
|
365
365
|
}
|
@@ -453,7 +453,7 @@ export const __console_assert = (assertion: any, ...args: any[]) => {
|
|
453
453
|
};
|
454
454
|
|
455
455
|
export const __Porffor_dirObject = (obj: any, colors: boolean, depth: i32, showHidden: boolean) => {
|
456
|
-
if (Porffor.
|
456
|
+
if (Porffor.type(obj) != Porffor.TYPES.object || depth == 0) {
|
457
457
|
__Porffor_print(obj, colors);
|
458
458
|
return;
|
459
459
|
}
|
@@ -9,7 +9,7 @@ export const DataView = function (arg: any, byteOffset: any, length: any): DataV
|
|
9
9
|
let len: i32 = 0;
|
10
10
|
let bufferPtr: i32;
|
11
11
|
|
12
|
-
const type: i32 = Porffor.
|
12
|
+
const type: i32 = Porffor.type(arg);
|
13
13
|
if (Porffor.fastOr(
|
14
14
|
type == Porffor.TYPES.arraybuffer,
|
15
15
|
type == Porffor.TYPES.sharedarraybuffer
|
@@ -19,13 +19,13 @@ export const DataView = function (arg: any, byteOffset: any, length: any): DataV
|
|
19
19
|
if (arg.detached) throw new TypeError('Constructed DataView with a detached ArrayBuffer');
|
20
20
|
|
21
21
|
let offset: i32 = 0;
|
22
|
-
if (Porffor.
|
22
|
+
if (Porffor.type(byteOffset) != Porffor.TYPES.undefined) offset = Math.trunc(byteOffset);
|
23
23
|
if (offset < 0) throw new RangeError('Invalid DataView byte offset (negative)');
|
24
24
|
|
25
25
|
Porffor.wasm.i32.store(outPtr, offset, 0, 8);
|
26
26
|
Porffor.wasm.i32.store(outPtr, bufferPtr + offset, 0, 4);
|
27
27
|
|
28
|
-
if (Porffor.
|
28
|
+
if (Porffor.type(length) == Porffor.TYPES.undefined) {
|
29
29
|
const bufferLen: i32 = Porffor.wasm.i32.load(bufferPtr, 0, 0);
|
30
30
|
len = bufferLen - byteOffset;
|
31
31
|
} else len = Math.trunc(length);
|