porffor 0.33.0 → 0.33.2
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/compiler/builtins/object.ts +14 -1
- package/compiler/builtins_precompiled.js +7 -2
- package/compiler/codegen.js +92 -97
- package/package.json +1 -1
- package/runner/index.js +1 -1
@@ -226,6 +226,18 @@ export const __Object_assign = (target: any, ...sources: any[]) => {
|
|
226
226
|
return target;
|
227
227
|
};
|
228
228
|
|
229
|
+
// Object.assign but also non enumerable properties and 1 source
|
230
|
+
export const __Porffor_object_assignAll = (target: any, source: any) => {
|
231
|
+
if (target == null) throw new TypeError('Argument is nullish, expected object');
|
232
|
+
|
233
|
+
const keys: any[] = Reflect.ownKeys(source);
|
234
|
+
for (const x of keys) {
|
235
|
+
target[x] = source[x];
|
236
|
+
}
|
237
|
+
|
238
|
+
return target;
|
239
|
+
};
|
240
|
+
|
229
241
|
|
230
242
|
export const __Object_prototype_propertyIsEnumerable = (_this: any, prop: any) => {
|
231
243
|
const p: any = ecma262.ToPropertyKey(prop);
|
@@ -384,7 +396,8 @@ export const __Object_getOwnPropertyDescriptors = (obj: any): any => {
|
|
384
396
|
if (Porffor.rawType(obj) != Porffor.TYPES.object) return out;
|
385
397
|
}
|
386
398
|
|
387
|
-
|
399
|
+
const keys: any[] = Reflect.ownKeys(obj);
|
400
|
+
for (const x of keys) {
|
388
401
|
out[x] = __Object_getOwnPropertyDescriptor(obj, x);
|
389
402
|
}
|
390
403
|
|
@@ -1529,6 +1529,11 @@ params:[124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
|
|
1529
1529
|
locals:[124,127,127,127,127,124,127,124,127,124,127,124,124,124,124,127,124,124,124,127,127,127,127],localNames:["target","target#type","sources","sources#type","#logicinner_tmp","#typeswitch_tmp1","#forof_base_pointer0","#forof_length0","#forof_counter0","#forof_tmp0","#forof_tmp0#type","x","x#type","keys","#last_type","vals","len","i","#member_setter_val_tmp","#member_setter_ptr_tmp","#member_obj","#member_prop_assign","#member_prop","#loadArray_offset","#member_allocd","#swap","#forof_allocd"],
|
1530
1530
|
hasRestArgument:1,
|
1531
1531
|
};
|
1532
|
+
this.__Porffor_object_assignAll = {
|
1533
|
+
wasm:(_,{builtin,internalThrow})=>[[32,0],[33,4],[32,1],[33,5],[2,127],[32,5],[65,0],[70],[4,64,"TYPESWITCH|empty"],[65,1],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,4],[68,0],[97],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],[65,1],[12,1],[11],[65,0],[11,"TYPESWITCH_end"],[4,64],...internalThrow(_,'TypeError',`Argument is nullish, expected object`),[11],[32,2],[32,3],[16,builtin('__Reflect_ownKeys')],[26],[34,6],[252,3],[33,8],[65,0],[33,10],[65,208,0],[65,208,0],[70],[65,208,0],[65,19],[70],[114],[65,208,0],[65,195,0],[70],[114],[65,208,0],[65,195,1],[70],[114],[65,208,0],[65,216,0],[78],[65,208,0],[65,224,0],[76],[113],[114],[69],[4,64],...internalThrow(_,'TypeError',`Tried for..of on non-iterable type`),[11],[32,8],[40,1,0],[34,9],[4,64],[3,64],[32,8],[43,0,4],[33,11],[32,8],[45,0,12],[33,12],[32,11],[33,13],[32,12],[33,14],[2,64],[2,64],[32,0],[33,17],[32,13],[33,18],[32,1],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,1],[32,18],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[32,7],[16,builtin('__Porffor_object_set')],[26],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,1],[32,18],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[32,7],[16,builtin('__Porffor_object_set')],[26],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,17],[252,3],[32,18],[252,3],[65,9],[108],[106],[34,16],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[57,0,4],[32,16],[32,7],[58,0,12],[32,15],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[252,3],[58,0,4],[32,15],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[252,2],[58,0,4],[32,15],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[68,0],[165],[68,255],[164],[252,3],[58,0,4],[32,15],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[65,2],[108],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[252,3],[59,0,4],[32,15],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[65,2],[108],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[252,2],[59,0,4],[32,15],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[65,4],[108],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[252,3],[54,0,4],[32,15],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[65,4],[108],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[252,2],[54,0,4],[32,15],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[65,4],[108],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[182],[56,0,4],[32,15],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,18],[252,3],[65,8],[108],[106],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[34,15],[57,0,4],[32,15],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot set property of undefined`),[68,0],[12,1],[11],[32,2],[33,17],[32,13],[33,19],[32,3],[33,5],[2,124],[32,5],[65,6],[70],[4,64,"TYPESWITCH|Function"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,17],[252,3],[32,3],[32,19],[32,14],[16,builtin('__ecma262_ToPropertyKey')],[33,22],[252,3],[32,22],[16,builtin('__Porffor_object_get')],[33,7],[12,1],[11],[32,5],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[65,2],[108],[32,17],[252,3],[106],[47,0,4],[59,0,4],[32,21],[184],[65,195,0],[33,7],[12,1],[11],[32,5],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,19],[252,3],[65,9],[108],[32,17],[252,3],[106],[34,20],[43,0,4],[32,20],[45,0,12],[33,7],[12,1],[11],[32,5],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11],[32,5],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11],[32,5],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11],[32,5],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,17],[252,3],[40,0,4],[32,19],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11],[32,5],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11],[32,5],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[16,builtin('__Porffor_allocate')],[34,21],[65,1],[54,0,0],[32,21],[32,19],[252,3],[32,17],[252,3],[106],[45,0,4],[58,0,4],[32,21],[184],[65,195,1],[33,7],[12,1],[11],[68,0],[65,128,1],[33,7],[11,"TYPESWITCH_end"],[11,"TYPESWITCH_end"],[26],[11],[32,8],[65,9],[106],[33,8],[32,10],[65,1],[106],[34,10],[32,9],[71],[13,1],[11],[11],[11],[32,0],[32,1],[15]],
|
1534
|
+
params:[124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
|
1535
|
+
locals:[124,127,124,127,127,127,127,124,127,124,127,124,127,124,124,124,127,127,127,127],localNames:["target","target#type","source","source#type","#logicinner_tmp","#typeswitch_tmp1","keys","#last_type","#forof_base_pointer1","#forof_length1","#forof_counter1","#forof_tmp1","#forof_tmp1#type","x","x#type","#member_setter_val_tmp","#member_setter_ptr_tmp","#member_obj","#member_prop_assign","#member_prop","#loadArray_offset","#member_allocd","#swap","#forof_allocd"],
|
1536
|
+
};
|
1532
1537
|
this.__Object_prototype_propertyIsEnumerable = {
|
1533
1538
|
wasm:(_,{builtin})=>[[32,2],[32,3],[16,builtin('__ecma262_ToPropertyKey')],[33,5],[33,4],[32,1],[184],[34,7],[68,7],[97],[4,64],[32,0],[252,2],[32,1],[32,4],[252,2],[32,5],[16,builtin('__Porffor_object_lookup')],[33,6],[183],[34,8],[68,-1],[97],[4,64],[68,0],[65,2],[15],[11],[32,8],[252,2],[65,1],[16,builtin('__Porffor_object_isEnumerable')],[33,6],[183],[32,6],[15],[11],[32,0],[32,1],[16,builtin('__Object_keys')],[26],[34,9],[65,208,0],[32,4],[32,5],[68,0],[65,128,1],[16,builtin('__Array_prototype_includes')],[34,6],[15]],
|
1534
1539
|
params:[124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
|
@@ -1575,9 +1580,9 @@ params:[124,127,124,127],typedParams:1,returns:[124,127],typedReturns:1,
|
|
1575
1580
|
locals:[124,127,127,124,124,127,124,124,127,127,127,127,124,124,124,127,124,127,124,124,124,127],localNames:["obj","obj#type","prop","prop#type","p","p#type","#last_type","objType","v","v#type","#member_obj","#member_prop","#loadArray_offset","#member_allocd","#swap","#typeswitch_tmp1","#logicinner_tmp","out","#member_setter_val_tmp","#member_setter_ptr_tmp","#member_prop_assign","#makearray_pointer_tmp","entryPtr","tail","value","value#type"],
|
1576
1581
|
};
|
1577
1582
|
this.__Object_getOwnPropertyDescriptors = {
|
1578
|
-
wasm:(_,{builtin,internalThrow})=>[[16,builtin('__Porffor_allocate')],[184],[33,2],[32,1],[184],[68,7],[98],[4,64],[32,0],[32,1],[16,builtin('__Porffor_object_getObject')],[33,1],[33,0],[32,1],[184],[68,7],[98],[4,64],[32,2],[65,7],[15],[11],[11],[32,0],[252,3],[33,
|
1583
|
+
wasm:(_,{builtin,internalThrow})=>[[16,builtin('__Porffor_allocate')],[184],[33,2],[32,1],[184],[68,7],[98],[4,64],[32,0],[32,1],[16,builtin('__Porffor_object_getObject')],[33,1],[33,0],[32,1],[184],[68,7],[98],[4,64],[32,2],[65,7],[15],[11],[11],[32,0],[32,1],[16,builtin('__Reflect_ownKeys')],[26],[34,4],[252,3],[33,5],[65,0],[33,7],[65,208,0],[65,208,0],[70],[65,208,0],[65,19],[70],[114],[65,208,0],[65,195,0],[70],[114],[65,208,0],[65,195,1],[70],[114],[65,208,0],[65,216,0],[78],[65,208,0],[65,224,0],[76],[113],[114],[69],[4,64],...internalThrow(_,'TypeError',`Tried for..of on non-iterable type`),[11],[32,5],[40,1,0],[34,6],[4,64],[3,64],[32,5],[43,0,4],[33,8],[32,5],[45,0,12],[33,9],[32,8],[33,10],[32,9],[33,11],[2,64],[32,2],[33,14],[32,10],[33,15],[32,14],[252,3],[65,7],[32,15],[32,11],[16,builtin('__ecma262_ToPropertyKey')],[33,16],[252,3],[32,16],[32,0],[32,1],[32,10],[32,11],[16,builtin('__Object_getOwnPropertyDescriptor')],[34,3],[16,builtin('__Porffor_object_set')],[26],[26],[32,5],[65,9],[106],[33,5],[32,7],[65,1],[106],[34,7],[32,6],[71],[13,1],[11],[11],[11],[32,2],[65,7],[15]],
|
1579
1584
|
params:[124,127],typedParams:1,returns:[124,127],typedReturns:1,
|
1580
|
-
locals:[124,127,
|
1585
|
+
locals:[124,127,124,127,127,127,124,127,124,127,124,127,124,124,127,127],localNames:["obj","obj#type","out","#last_type","keys","#forof_base_pointer1","#forof_length1","#forof_counter1","#forof_tmp1","#forof_tmp1#type","x","x#type","#member_setter_val_tmp","#member_setter_ptr_tmp","#member_obj","#member_prop_assign","#swap","#forof_allocd"],
|
1581
1586
|
};
|
1582
1587
|
this.__Object_getOwnPropertyNames = {
|
1583
1588
|
wasm:(_,{builtin,internalThrow})=>[[32,0],[33,2],[32,1],[33,3],[2,127],[32,3],[65,0],[70],[4,64,"TYPESWITCH|empty"],[65,1],[12,1],[11],[32,3],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,2],[68,0],[97],[12,1],[11],[32,3],[65,128,1],[70],[4,64,"TYPESWITCH|undefined"],[65,1],[12,1],[11],[65,0],[11,"TYPESWITCH_end"],[4,64],...internalThrow(_,'TypeError',`Argument is nullish, expected object`),[11],[16,builtin('__Porffor_allocate')],[183],[33,4],[32,1],[184],[34,5],[68,7],[97],[4,64],[32,0],[68,5],[160],[34,6],[32,0],[252,2],[40,0,0],[183],[68,14],[162],[160],[33,7],[68,0],[33,8],[3,64],[32,6],[32,7],[99],[4,64],[2,64],[32,6],[252,3],[40,0,0],[34,11],[65,30],[118],[34,12],[4,127],[65,5],[65,195,0],[32,12],[65,3],[70],[27],[33,10],[32,11],[65,255,255,255,255,3],[113],[5],[65,195,1],[33,10],[32,11],[11],[184],[33,9],[32,10],[184],[68,5],[97],[4,64],[12,1],[11],[32,4],[33,15],[32,8],[32,8],[68,1],[160],[33,8],[33,16],[32,15],[252,3],[32,16],[252,3],[65,9],[108],[106],[34,14],[32,9],[34,13],[57,0,4],[32,14],[32,10],[58,0,12],[11],[32,6],[68,14],[160],[34,6],[12,1],[11],[11],[32,4],[252,3],[34,19],[32,8],[34,18],[252,3],[54,1,0],[5],[32,5],[68,80],[97],[32,5],[68,195],[97],[114],[32,5],[68,67],[97],[114],[4,64],[32,0],[252,3],[40,1,0],[184],[33,20],[32,4],[252,3],[34,19],[32,20],[34,18],[252,3],[54,1,0],[68,0],[33,8],[3,64],[32,8],[32,20],[99],[4,64],[32,4],[33,15],[32,8],[33,16],[32,15],[252,3],[32,16],[252,3],[65,9],[108],[106],[34,14],[32,8],[65,1],[68,0],[65,128,1],[16,builtin('__Number_prototype_toString')],[33,21],[34,13],[57,0,4],[32,14],[32,21],[58,0,12],[32,8],[68,1],[160],[33,8],[12,1],[11],[11],[11],[11],[32,4],[65,208,0],[15]],
|
package/compiler/codegen.js
CHANGED
@@ -71,15 +71,8 @@ const generate = (scope, decl, global = false, name = undefined, valueUnused = f
|
|
71
71
|
|
72
72
|
case 'ArrowFunctionExpression':
|
73
73
|
case 'FunctionDeclaration':
|
74
|
-
case 'FunctionExpression':
|
75
|
-
|
76
|
-
|
77
|
-
if (decl.type.endsWith('Expression')) {
|
78
|
-
return cacheAst(decl, funcRef(func.index, func.name));
|
79
|
-
}
|
80
|
-
|
81
|
-
return cacheAst(decl, []);
|
82
|
-
}
|
74
|
+
case 'FunctionExpression':
|
75
|
+
return cacheAst(decl, generateFunc(scope, decl)[1]);
|
83
76
|
|
84
77
|
case 'BlockStatement':
|
85
78
|
return cacheAst(decl, generateCode(scope, decl));
|
@@ -406,12 +399,12 @@ const generateReturn = (scope, decl) => {
|
|
406
399
|
// ignore return value and return this if being constructed
|
407
400
|
// todo: only do this when trying to return a primitive?
|
408
401
|
out.push(
|
409
|
-
// ...truthy(scope, [ [ Opcodes.local_get, '#newtarget' ] ], [ [ Opcodes.local_get, '#newtarget#type' ] ], false, true),
|
410
|
-
[ Opcodes.local_get, '#newtarget' ],
|
402
|
+
// ...truthy(scope, [ [ Opcodes.local_get, scope.locals['#newtarget'].idx ] ], [ [ Opcodes.local_get, scope.locals['#newtarget#type'].idx ] ], false, true),
|
403
|
+
[ Opcodes.local_get, scope.locals['#newtarget'].idx ],
|
411
404
|
Opcodes.i32_to_u,
|
412
405
|
[ Opcodes.if, Blocktype.void ],
|
413
|
-
[ Opcodes.local_get, '#this' ],
|
414
|
-
...(scope.returnType != null ? [] : [ [ Opcodes.local_get, '#this#type' ] ]),
|
406
|
+
[ Opcodes.local_get, scope.locals['#this'].idx ],
|
407
|
+
...(scope.returnType != null ? [] : [ [ Opcodes.local_get, scope.locals['#this#type'].idx ] ]),
|
415
408
|
[ Opcodes.return ],
|
416
409
|
[ Opcodes.end ]
|
417
410
|
);
|
@@ -1704,13 +1697,13 @@ const getNodeType = (scope, node) => {
|
|
1704
1697
|
|
1705
1698
|
if (node.type === 'ThisExpression') {
|
1706
1699
|
if (!scope.constr) return getType(scope, 'globalThis');
|
1707
|
-
return [ [ Opcodes.local_get, '#this#type' ] ];
|
1700
|
+
return [ [ Opcodes.local_get, scope.locals['#this#type'].idx ] ];
|
1708
1701
|
}
|
1709
1702
|
|
1710
1703
|
if (node.type === 'MetaProperty') {
|
1711
1704
|
switch (`${node.meta.name}.${node.property.name}`) {
|
1712
1705
|
case 'new.target': {
|
1713
|
-
return [ [ Opcodes.local_get, '#newtarget#type' ] ];
|
1706
|
+
return [ [ Opcodes.local_get, scope.locals['#newtarget#type'].idx ] ];
|
1714
1707
|
}
|
1715
1708
|
|
1716
1709
|
default:
|
@@ -2008,9 +2001,12 @@ const createThisArg = (scope, decl, knownThis = undefined) => {
|
|
2008
2001
|
};
|
2009
2002
|
|
2010
2003
|
const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
2004
|
+
let out = [];
|
2011
2005
|
let name = mapName(decl.callee.name);
|
2012
|
-
|
2013
|
-
|
2006
|
+
|
2007
|
+
// opt: virtualize iifes
|
2008
|
+
if (isFuncType(decl.callee.type)) {
|
2009
|
+
const [ func ] = generateFunc(scope, decl.callee);
|
2014
2010
|
name = func.name;
|
2015
2011
|
}
|
2016
2012
|
|
@@ -2108,7 +2104,6 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
2108
2104
|
target = decl.callee.object;
|
2109
2105
|
}
|
2110
2106
|
|
2111
|
-
let out = [];
|
2112
2107
|
if (protoName) {
|
2113
2108
|
if (protoName === 'call') {
|
2114
2109
|
const valTmp = localTmp(scope, '#call_val');
|
@@ -2767,25 +2762,31 @@ const generateThis = (scope, decl, _global, _name) => {
|
|
2767
2762
|
];
|
2768
2763
|
}
|
2769
2764
|
|
2765
|
+
// opt: do not check for pure constructors
|
2766
|
+
if (scope._onlyConstr) return [
|
2767
|
+
[ Opcodes.local_get, scope.locals['#this'].idx ],
|
2768
|
+
...setLastType(scope, [ [ Opcodes.local_get, scope.locals['#this#type'].idx ] ])
|
2769
|
+
];
|
2770
|
+
|
2770
2771
|
return [
|
2771
2772
|
// default this to globalThis
|
2772
|
-
[ Opcodes.local_get, '#this' ],
|
2773
|
+
[ Opcodes.local_get, scope.locals['#this'].idx ],
|
2773
2774
|
Opcodes.i32_to_u,
|
2774
2775
|
[ Opcodes.i32_eqz ],
|
2775
2776
|
[ Opcodes.if, Blocktype.void ],
|
2776
|
-
[ Opcodes.local_get, '#this#type' ],
|
2777
|
+
[ Opcodes.local_get, scope.locals['#this#type'].idx ],
|
2777
2778
|
...number(TYPES.object, Valtype.i32),
|
2778
2779
|
[ Opcodes.i32_eq ],
|
2779
2780
|
[ Opcodes.if, Blocktype.void ],
|
2780
2781
|
...generate(scope, { type: 'Identifier', name: 'globalThis' }),
|
2781
|
-
[ Opcodes.local_set, '#this' ],
|
2782
|
+
[ Opcodes.local_set, scope.locals['#this'].idx ],
|
2782
2783
|
...getType(scope, 'globalThis'),
|
2783
|
-
[ Opcodes.local_set, '#this#type' ],
|
2784
|
+
[ Opcodes.local_set, scope.locals['#this#type'].idx ],
|
2784
2785
|
[ Opcodes.end ],
|
2785
2786
|
[ Opcodes.end ],
|
2786
2787
|
|
2787
|
-
[ Opcodes.local_get, '#this' ],
|
2788
|
-
...setLastType(scope, [ [ Opcodes.local_get, '#this#type' ] ])
|
2788
|
+
[ Opcodes.local_get, scope.locals['#this'].idx ],
|
2789
|
+
...setLastType(scope, [ [ Opcodes.local_get, scope.locals['#this#type'].idx ] ])
|
2789
2790
|
];
|
2790
2791
|
};
|
2791
2792
|
|
@@ -4913,11 +4914,9 @@ const generateEmpty = (scope, decl) => {
|
|
4913
4914
|
|
4914
4915
|
const generateMeta = (scope, decl) => {
|
4915
4916
|
switch (`${decl.meta.name}.${decl.property.name}`) {
|
4916
|
-
case 'new.target':
|
4917
|
-
|
4918
|
-
|
4919
|
-
];
|
4920
|
-
}
|
4917
|
+
case 'new.target': return [
|
4918
|
+
[ Opcodes.local_get, scope.locals['#newtarget'].idx ],
|
4919
|
+
];
|
4921
4920
|
|
4922
4921
|
default:
|
4923
4922
|
return todo(scope, `meta property object ${decl.meta.name} is not supported yet`, true);
|
@@ -5775,7 +5774,7 @@ const generateClass = (scope, decl) => {
|
|
5775
5774
|
const expr = decl.type === 'ClassExpression';
|
5776
5775
|
if (decl.superClass) return todo(scope, 'class extends is not supported yet', expr);
|
5777
5776
|
|
5778
|
-
const name = decl.id.name
|
5777
|
+
const name = decl.id ? decl.id.name : `#anonymous${uniqId()}`;
|
5779
5778
|
if (name == null) return todo(scope, 'unknown name for class', expr);
|
5780
5779
|
|
5781
5780
|
const body = decl.body.body;
|
@@ -5794,21 +5793,19 @@ const generateClass = (scope, decl) => {
|
|
5794
5793
|
}
|
5795
5794
|
};
|
5796
5795
|
|
5797
|
-
const func = generateFunc(scope, {
|
5796
|
+
const [ func, out ] = generateFunc(scope, {
|
5798
5797
|
...constr,
|
5799
|
-
_onlyConstr:
|
5798
|
+
_onlyConstr: true,
|
5800
5799
|
type: expr ? 'FunctionExpression' : 'FunctionDeclaration'
|
5801
5800
|
});
|
5802
5801
|
|
5803
|
-
const out = [];
|
5804
|
-
|
5805
5802
|
for (const x of body) {
|
5806
5803
|
let { type, key, value, kind, static: _static, computed } = x;
|
5807
5804
|
if (type !== 'MethodDefinition' && type !== 'PropertyDefinition') return todo(scope, `class body type ${type} is not supported yet`, expr);
|
5808
5805
|
|
5809
5806
|
if (kind === 'constructor') continue;
|
5810
5807
|
|
5811
|
-
|
5808
|
+
let object = _static ? root : {
|
5812
5809
|
type: 'MemberExpression',
|
5813
5810
|
object: root,
|
5814
5811
|
property: {
|
@@ -5831,27 +5828,47 @@ const generateClass = (scope, decl) => {
|
|
5831
5828
|
// default value to undefined
|
5832
5829
|
value ??= DEFAULT_VALUE();
|
5833
5830
|
|
5834
|
-
out
|
5835
|
-
|
5831
|
+
let outArr = out, outOp = 'push', outScope = scope;
|
5832
|
+
if (type === 'PropertyDefinition' && !_static) {
|
5833
|
+
// define in construction instead
|
5834
|
+
outArr = func.wasm;
|
5835
|
+
outOp = 'unshift';
|
5836
|
+
object = {
|
5837
|
+
type: 'ThisExpression'
|
5838
|
+
};
|
5839
|
+
outScope = func;
|
5840
|
+
}
|
5841
|
+
|
5842
|
+
outArr[outOp](
|
5843
|
+
...generate(outScope, object),
|
5836
5844
|
Opcodes.i32_to_u,
|
5837
|
-
...getNodeType(
|
5845
|
+
...getNodeType(outScope, object),
|
5838
5846
|
|
5839
|
-
...generate(
|
5840
|
-
...getNodeType(
|
5841
|
-
...toPropertyKey(
|
5847
|
+
...generate(outScope, k),
|
5848
|
+
...getNodeType(outScope, k),
|
5849
|
+
...toPropertyKey(outScope, true),
|
5842
5850
|
|
5843
|
-
...generate(
|
5851
|
+
...generate(outScope, value),
|
5844
5852
|
...(initKind !== 'init' ? [ Opcodes.i32_to_u ] : []),
|
5845
|
-
...getNodeType(
|
5853
|
+
...getNodeType(outScope, value),
|
5846
5854
|
|
5847
|
-
[ Opcodes.call, includeBuiltin(
|
5855
|
+
[ Opcodes.call, includeBuiltin(outScope, `__Porffor_object_expr_${initKind}`).index ],
|
5848
5856
|
|
5849
5857
|
[ Opcodes.drop ],
|
5850
5858
|
[ Opcodes.drop ]
|
5851
5859
|
);
|
5852
5860
|
}
|
5853
5861
|
|
5854
|
-
if
|
5862
|
+
// error if not being constructed
|
5863
|
+
func.wasm.unshift(
|
5864
|
+
[ Opcodes.local_get, func.locals['#newtarget'].idx ],
|
5865
|
+
Opcodes.i32_to_u,
|
5866
|
+
[ Opcodes.i32_eqz ],
|
5867
|
+
[ Opcodes.if, Blocktype.void ],
|
5868
|
+
...internalThrow(func, 'TypeError', `Class constructor ${name} requires 'new'`),
|
5869
|
+
[ Opcodes.end ]
|
5870
|
+
);
|
5871
|
+
|
5855
5872
|
return out;
|
5856
5873
|
};
|
5857
5874
|
|
@@ -5906,6 +5923,16 @@ const objectHack = node => {
|
|
5906
5923
|
|
5907
5924
|
const generateFunc = (scope, decl) => {
|
5908
5925
|
const name = decl.id ? decl.id.name : `#anonymous${uniqId()}`;
|
5926
|
+
if (decl.type.startsWith('Class')) {
|
5927
|
+
const out = generateClass(scope, {
|
5928
|
+
...decl,
|
5929
|
+
id: { name }
|
5930
|
+
});
|
5931
|
+
|
5932
|
+
const func = funcs.find(x => x.name === name);
|
5933
|
+
return [ func, out ];
|
5934
|
+
}
|
5935
|
+
|
5909
5936
|
const params = decl.params ?? [];
|
5910
5937
|
|
5911
5938
|
// TODO: share scope/locals between !!!
|
@@ -5921,12 +5948,15 @@ const generateFunc = (scope, decl) => {
|
|
5921
5948
|
(decl.type && decl.type !== 'ArrowFunctionExpression' && decl.type !== 'Program') &&
|
5922
5949
|
// not async or generator
|
5923
5950
|
!decl.async && !decl.generator,
|
5951
|
+
_onlyConstr: decl._onlyConstr,
|
5924
5952
|
strict: scope.strict
|
5925
5953
|
};
|
5926
5954
|
|
5927
5955
|
funcIndex[name] = func.index;
|
5928
5956
|
funcs.push(func);
|
5929
5957
|
|
5958
|
+
const out = decl.type.endsWith('Expression') ? funcRef(func.index, func.name) : [];
|
5959
|
+
|
5930
5960
|
let errorWasm = null;
|
5931
5961
|
if (decl.generator) errorWasm = todo(scope, 'generator functions are not supported');
|
5932
5962
|
|
@@ -5937,7 +5967,7 @@ const generateFunc = (scope, decl) => {
|
|
5937
5967
|
]);
|
5938
5968
|
func.params = [];
|
5939
5969
|
func.constr = false;
|
5940
|
-
return func;
|
5970
|
+
return [ func, out ];
|
5941
5971
|
}
|
5942
5972
|
|
5943
5973
|
if (typedInput && decl.returnType) {
|
@@ -5949,6 +5979,11 @@ const generateFunc = (scope, decl) => {
|
|
5949
5979
|
}
|
5950
5980
|
}
|
5951
5981
|
|
5982
|
+
if (func.constr) {
|
5983
|
+
allocVar(func, '#newtarget', false);
|
5984
|
+
allocVar(func, '#this', false);
|
5985
|
+
}
|
5986
|
+
|
5952
5987
|
const prelude = [];
|
5953
5988
|
const defaultValues = {};
|
5954
5989
|
const destructuredArgs = {};
|
@@ -5992,7 +6027,7 @@ const generateFunc = (scope, decl) => {
|
|
5992
6027
|
TYPES.arraybuffer, TYPES.sharedarraybuffer, TYPES.dataview
|
5993
6028
|
].includes(typeAnno.type)) {
|
5994
6029
|
prelude.push(
|
5995
|
-
[ Opcodes.local_get,
|
6030
|
+
[ Opcodes.local_get, func.locals[name].idx + 1 ],
|
5996
6031
|
...number(typeAnno.type, Valtype.i32),
|
5997
6032
|
[ Opcodes.i32_ne ],
|
5998
6033
|
[ Opcodes.if, Blocktype.void ],
|
@@ -6057,25 +6092,16 @@ const generateFunc = (scope, decl) => {
|
|
6057
6092
|
|
6058
6093
|
if (!globalThis.precompile && func.constr) {
|
6059
6094
|
wasm.unshift(
|
6060
|
-
//
|
6061
|
-
|
6062
|
-
|
6063
|
-
|
6095
|
+
// opt: do not check for pure constructors
|
6096
|
+
...(func._onlyConstr ? [] : [
|
6097
|
+
// if being constructed
|
6098
|
+
[ Opcodes.local_get, func.locals['#newtarget'].idx ],
|
6099
|
+
Opcodes.i32_to_u,
|
6100
|
+
[ Opcodes.if, Blocktype.void ],
|
6101
|
+
]),
|
6064
6102
|
// set prototype of this ;)
|
6065
6103
|
...generate(func, setObjProp({ type: 'ThisExpression' }, '__proto__', getObjProp(func.name, 'prototype'))),
|
6066
|
-
[ Opcodes.end ]
|
6067
|
-
);
|
6068
|
-
}
|
6069
|
-
|
6070
|
-
if (decl._onlyConstr) {
|
6071
|
-
wasm.unshift(
|
6072
|
-
// error if not being constructed
|
6073
|
-
[ Opcodes.local_get, '#newtarget' ],
|
6074
|
-
Opcodes.i32_to_u,
|
6075
|
-
[ Opcodes.i32_eqz ],
|
6076
|
-
[ Opcodes.if, Blocktype.void ],
|
6077
|
-
...internalThrow(func, 'TypeError', decl._onlyConstr),
|
6078
|
-
[ Opcodes.end ]
|
6104
|
+
...(func._onlyConstr ? [] : [ [ Opcodes.end ] ])
|
6079
6105
|
);
|
6080
6106
|
}
|
6081
6107
|
|
@@ -6131,38 +6157,7 @@ const generateFunc = (scope, decl) => {
|
|
6131
6157
|
}
|
6132
6158
|
}
|
6133
6159
|
|
6134
|
-
|
6135
|
-
const locals = func.locals;
|
6136
|
-
let idxOffset = 4;
|
6137
|
-
func.params = [ valtypeBinary, Valtype.i32, valtypeBinary, Valtype.i32, ...func.params ];
|
6138
|
-
|
6139
|
-
// move all local indexes by idxOffset
|
6140
|
-
func.localInd += idxOffset;
|
6141
|
-
for (const x in locals) {
|
6142
|
-
locals[x].idx += idxOffset;
|
6143
|
-
}
|
6144
|
-
|
6145
|
-
let indexes = idxOffset;
|
6146
|
-
|
6147
|
-
locals['#this#type'] = { idx: --indexes, type: Valtype.i32 };
|
6148
|
-
locals['#this'] = { idx: --indexes, type: valtypeBinary };
|
6149
|
-
locals['#newtarget#type'] = { idx: --indexes, type: Valtype.i32 };
|
6150
|
-
locals['#newtarget'] = { idx: --indexes, type: valtypeBinary };
|
6151
|
-
|
6152
|
-
for (let i = 0; i < wasm.length; i++) {
|
6153
|
-
// note: these needs to be copied, even though they realistically shouldn't
|
6154
|
-
const inst = wasm[i];
|
6155
|
-
if (inst[0] === Opcodes.local_get || inst[0] === Opcodes.local_set || inst[0] === Opcodes.local_tee) {
|
6156
|
-
if (typeof inst[1] == 'string') {
|
6157
|
-
wasm[i] = [ inst[0], locals[inst[1]].idx ];
|
6158
|
-
} else {
|
6159
|
-
wasm[i] = [ inst[0], inst[1] + idxOffset ];
|
6160
|
-
}
|
6161
|
-
}
|
6162
|
-
}
|
6163
|
-
}
|
6164
|
-
|
6165
|
-
return func;
|
6160
|
+
return [ func, out ];
|
6166
6161
|
};
|
6167
6162
|
|
6168
6163
|
const generateCode = (scope, decl) => {
|
@@ -6378,7 +6373,7 @@ export default program => {
|
|
6378
6373
|
|
6379
6374
|
if (Prefs.astLog) console.log(JSON.stringify(program.body.body, null, 2));
|
6380
6375
|
|
6381
|
-
const main = generateFunc(scope, program);
|
6376
|
+
const [ main ] = generateFunc(scope, program);
|
6382
6377
|
|
6383
6378
|
delete globals['#ind'];
|
6384
6379
|
|
package/package.json
CHANGED