porffor 0.18.24 → 0.18.25
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.
@@ -606,4 +606,28 @@ export const __Array_prototype_toSorted = (_this: any[], callbackFn: any) => {
|
|
606
606
|
return __Array_prototype_sort(out, callbackFn);
|
607
607
|
};
|
608
608
|
|
609
|
-
// todo: toSpliced
|
609
|
+
// todo: toSpliced
|
610
|
+
|
611
|
+
export const __Array_prototype_flat = (_this: any[], depth: any) => {
|
612
|
+
if (Porffor.rawType(depth) == Porffor.TYPES.undefined) depth = 1;
|
613
|
+
|
614
|
+
let out: any[] = Porffor.allocate();
|
615
|
+
if (depth <= 0) {
|
616
|
+
Porffor.clone(_this, out);
|
617
|
+
return out;
|
618
|
+
}
|
619
|
+
|
620
|
+
const len: i32 = _this.length;
|
621
|
+
let i: i32 = 0, j: i32 = 0;
|
622
|
+
while (i < len) {
|
623
|
+
let x: any = _this[i++];
|
624
|
+
if (Porffor.rawType(x) == Porffor.TYPES.array) {
|
625
|
+
if (depth > 1) x = __Array_prototype_flat(x, depth - 1);
|
626
|
+
for (const y of x) out[j++] = y;
|
627
|
+
} else out[j++] = x;
|
628
|
+
}
|
629
|
+
|
630
|
+
out.length = j;
|
631
|
+
|
632
|
+
return out;
|
633
|
+
};
|
@@ -348,6 +348,12 @@ export const BuiltinFuncs = function() {
|
|
348
348
|
returns: [124,127], typedReturns: 1,
|
349
349
|
locals: [124,127], localNames: ["_this","_this#type","callbackFn","callbackFn#type","out","#last_type"],
|
350
350
|
};
|
351
|
+
this.__Array_prototype_flat = {
|
352
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[97],[4,64],[68,0,0,0,0,0,0,240,63],[34,2],[65,0],[33,3],[26],[11],[16, builtin('__Porffor_allocate')],[33,5],[33,4],[32,2],[68,0,0,0,0,0,0,0,0],[101],[4,64],[32,0],[32,4],[16, builtin('__Porffor_clone')],[32,4],[65,208,0],[15],[11],[32,0],[252,3],[40,1,0],[184],[33,6],[68,0,0,0,0,0,0,0,0],[33,7],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,7],[32,6],[99],[4,64],[32,7],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,11],[43,0,4],[32,11],[45,0,12],[33,5],[33,9],[32,5],[33,10],[32,9],[32,10],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,84,64],[97],[4,64],[32,2],[68,0,0,0,0,0,0,240,63],[100],[4,64],[32,9],[32,10],[32,2],[68,0,0,0,0,0,0,240,63],[161],[65,0],[16, builtin('__Array_prototype_flat')],[33,10],[26],[11],[32,9],[252,3],[33,12],[65,0],[33,14],[32,12],[40,1,0],[33,13],[32,10],[33,19],[2,64],[32,19],[65,19],[70],[4,64,"TYPESWITCH|Set"],[3,64],[32,12],[43,0,4],[32,12],[45,0,12],[33,16],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,12],[65,9],[106],[33,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[65,194,0],[33,16],[65,128,128,8],[65,1],[54,0,0],[3,64],[65,128,128,8],[32,12],[47,0,4],[59,0,4],[68,0,0,0,0,0,0,0,65],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,12],[65,2],[106],[33,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[3,64],[32,12],[43,0,4],[32,12],[45,0,12],[33,16],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,12],[65,9],[106],[33,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,215,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[106],[45,0,4],[184],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,216,0],[70],[4,64,"TYPESWITCH|Int8Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[106],[44,0,4],[183],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,217,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[106],[45,0,4],[184],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,218,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,2],[108],[106],[47,0,4],[184],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,219,0],[70],[4,64,"TYPESWITCH|Int16Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,2],[108],[106],[46,0,4],[183],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,220,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,4],[108],[106],[40,0,4],[184],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,221,0],[70],[4,64,"TYPESWITCH|Int32Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,4],[108],[106],[40,0,4],[183],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,222,0],[70],[4,64,"TYPESWITCH|Float32Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,4],[108],[106],[42,0,4],[187],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,223,0],[70],[4,64,"TYPESWITCH|Float64Array"],[65,0],[33,16],[3,64],[32,12],[40,0,4],[32,14],[65,8],[108],[106],[43,0,4],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],[32,19],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[65,194,1],[33,16],[65,128,128,8],[65,1],[54,0,0],[3,64],[65,128,128,8],[32,12],[32,14],[106],[45,0,4],[58,0,4],[68,0,0,0,0,0,0,0,65],[33,15],[2,64],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,15],[34,17],[57,0,4],[32,18],[32,16],[58,0,12],[32,14],[65,1],[106],[34,14],[32,13],[71],[13,1],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `Tried for..of on non-iterable type`),[11,"TYPESWITCH_end"],[5],[32,4],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,18],[32,9],[34,17],[57,0,4],[32,18],[32,10],[58,0,12],[11],[12,1],[11],[11],[32,4],[252,3],[32,8],[34,20],[252,3],[54,1,0],[32,4],[65,208,0],[15]],
|
353
|
+
params: [124,127,124,127], typedParams: 1,
|
354
|
+
returns: [124,127], typedReturns: 1,
|
355
|
+
locals: [124,127,124,124,124,124,127,127,127,127,127,124,127,124,127,127,124], localNames: ["_this","_this#type","depth","depth#type","out","#last_type","len","i","j","x","x#type","#loadArray_offset","forof_base_pointer","forof_length","forof_counter","y","y#type","#member_setter_val_tmp","#member_setter_ptr_tmp","#typeswitch_tmp","__length_setter_tmp"],
|
356
|
+
};
|
351
357
|
this.__ArrayBuffer_isView = {
|
352
358
|
wasm: (scope, {builtin}) => [[32,1],[33,3],[2,124],[32,3],[65,22],[70],[4,64,"TYPESWITCH|DataView"],[32,0],[32,1],[16, builtin('__DataView_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,215,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,0],[32,1],[16, builtin('__Uint8Array_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,216,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,0],[32,1],[16, builtin('__Int8Array_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,217,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,0],[32,1],[16, builtin('__Uint8ClampedArray_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,218,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,0],[32,1],[16, builtin('__Uint16Array_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,219,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,0],[32,1],[16, builtin('__Int16Array_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,220,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,0],[32,1],[16, builtin('__Uint32Array_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,221,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,0],[32,1],[16, builtin('__Int32Array_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,222,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,0],[32,1],[16, builtin('__Float32Array_prototype_buffer$get')],[33,2],[12,1],[11],[32,3],[65,223,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,0],[32,1],[16, builtin('__Float64Array_prototype_buffer$get')],[33,2],[12,1],[11],[68,0,0,0,0,0,0,0,0],[65,3],[33,2],[11,"TYPESWITCH_end"],[33,4],[32,2],[33,3],[2,127],[32,3],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[32,4],[252,3],[40,1,0],[12,1],[11],[32,3],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,4],[252,3],[40,1,0],[12,1],[11],[32,4],[252,3],[11,"TYPESWITCH_end"],[4,64],[68,0,0,0,0,0,0,240,63],[65,1],[15],[11],[68,0,0,0,0,0,0,0,0],[65,1],[15]],
|
353
359
|
params: [124,127], typedParams: 1,
|
package/package.json
CHANGED