porffor 0.21.0 → 0.21.1
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.
@@ -192,11 +192,7 @@ export const __Object_assign = (target: any, ...sources: any[]) => {
|
|
192
192
|
|
193
193
|
export const __Object_defineProperty = (target: any, prop: any, descriptor: any) => {
|
194
194
|
if (!Porffor.object.isObject(target)) throw new TypeError('Target is a non-object');
|
195
|
-
|
196
|
-
// if (Porffor.rawType(descriptor) < 0x06) {
|
197
|
-
if (Porffor.rawType(descriptor) != Porffor.TYPES.object) {
|
198
|
-
throw new TypeError('Descriptor is a non-object');
|
199
|
-
}
|
195
|
+
if (!Porffor.object.isObject(descriptor)) throw new TypeError('Descriptor is a non-object');
|
200
196
|
|
201
197
|
const p: any = ecma262.ToPropertyKey(prop);
|
202
198
|
|
@@ -215,8 +211,12 @@ export const __Object_defineProperty = (target: any, prop: any, descriptor: any)
|
|
215
211
|
|
216
212
|
let accessor: boolean = false;
|
217
213
|
|
218
|
-
if
|
219
|
-
|
214
|
+
// todo: should check if has attributes not if undefined
|
215
|
+
if (get !== undefined || set !== undefined) {
|
216
|
+
if (get !== undefined && Porffor.rawType(get) != Porffor.TYPES.function) throw new TypeError('Getter must be a function');
|
217
|
+
if (set !== undefined && Porffor.rawType(set) != Porffor.TYPES.function) throw new TypeError('Setter must be a function');
|
218
|
+
|
219
|
+
if (value !== undefined || writable !== undefined) {
|
220
220
|
throw new TypeError('Descriptor cannot define both accessor and data descriptor attributes');
|
221
221
|
}
|
222
222
|
|
@@ -233,6 +233,17 @@ export const __Object_defineProperty = (target: any, prop: any, descriptor: any)
|
|
233
233
|
return target;
|
234
234
|
};
|
235
235
|
|
236
|
+
export const __Object_defineProperties = (target: any, props: any) => {
|
237
|
+
if (!Porffor.object.isObject(target)) throw new TypeError('Target is a non-object');
|
238
|
+
if (!Porffor.object.isObjectOrSymbol(props)) throw new TypeError('Props needs to be an object or symbol');
|
239
|
+
|
240
|
+
for (const x in props) {
|
241
|
+
__Object_defineProperty(target, x, props[x]);
|
242
|
+
}
|
243
|
+
|
244
|
+
return target;
|
245
|
+
};
|
246
|
+
|
236
247
|
|
237
248
|
export const __Object_prototype_propertyIsEnumerable = (_this: any, prop: any) => {
|
238
249
|
const p: any = ecma262.ToPropertyKey(prop);
|
@@ -1690,10 +1690,16 @@ export const BuiltinFuncs = function() {
|
|
1690
1690
|
hasRestArgument: 1,
|
1691
1691
|
};
|
1692
1692
|
this.__Object_defineProperty = {
|
1693
|
-
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isObject')],[33,6],[183],[33,7],[32,6],[33,8],[2,124],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,7],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,7],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,7],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Target is a non-object`),[11],[32,4],[32,5],[16, ...builtin('
|
1693
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isObject')],[33,6],[183],[33,7],[32,6],[33,8],[2,124],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,7],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,7],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,7],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Target is a non-object`),[11],[32,4],[252,2],[32,5],[16, ...builtin('__Porffor_object_isObject')],[33,6],[183],[33,7],[32,6],[33,8],[2,124],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,7],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,7],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,7],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Descriptor is a non-object`),[11],[32,2],[32,3],[16, ...builtin('__ecma262_ToPropertyKey')],[33,10],[33,9],[32,4],[34,11],[33,14],[32,15],[252,3],[34,18],[65,12],[54,1,0],[32,18],[65,227,0],[58,0,4],[32,18],[65,239,0],[58,0,5],[32,18],[65,238,0],[58,0,6],[32,18],[65,230,0],[58,0,7],[32,18],[65,233,0],[58,0,8],[32,18],[65,231,0],[58,0,9],[32,18],[65,245,0],[58,0,10],[32,18],[65,242,0],[58,0,11],[32,18],[65,225,0],[58,0,12],[32,18],[65,226,0],[58,0,13],[32,18],[65,236,0],[58,0,14],[32,18],[65,229,0],[58,0,15],[32,18],[184],[33,15],[32,14],[252,3],[65,7],[32,15],[65,195,1],[16, ...builtin('__ecma262_ToPropertyKey')],[33,17],[252,3],[32,17],[16, ...builtin('__Porffor_object_get')],[33,13],[33,12],[32,11],[33,14],[32,15],[252,3],[34,18],[65,10],[54,1,0],[32,18],[65,229,0],[58,0,4],[32,18],[65,238,0],[58,0,5],[32,18],[65,245,0],[58,0,6],[32,18],[65,237,0],[58,0,7],[32,18],[65,229,0],[58,0,8],[32,18],[65,242,0],[58,0,9],[32,18],[65,225,0],[58,0,10],[32,18],[65,226,0],[58,0,11],[32,18],[65,236,0],[58,0,12],[32,18],[65,229,0],[58,0,13],[32,18],[184],[33,15],[32,14],[252,3],[65,7],[32,15],[65,195,1],[16, ...builtin('__ecma262_ToPropertyKey')],[33,17],[252,3],[32,17],[16, ...builtin('__Porffor_object_get')],[33,20],[33,19],[32,11],[33,14],[32,15],[252,3],[34,18],[65,5],[54,1,0],[32,18],[65,246,0],[58,0,4],[32,18],[65,225,0],[58,0,5],[32,18],[65,236,0],[58,0,6],[32,18],[65,245,0],[58,0,7],[32,18],[65,229,0],[58,0,8],[32,18],[184],[33,15],[32,14],[252,3],[65,7],[32,15],[65,195,1],[16, ...builtin('__ecma262_ToPropertyKey')],[33,17],[252,3],[32,17],[16, ...builtin('__Porffor_object_get')],[33,22],[33,21],[32,11],[33,14],[32,15],[252,3],[34,18],[65,8],[54,1,0],[32,18],[65,247,0],[58,0,4],[32,18],[65,242,0],[58,0,5],[32,18],[65,233,0],[58,0,6],[32,18],[65,244,0],[58,0,7],[32,18],[65,225,0],[58,0,8],[32,18],[65,226,0],[58,0,9],[32,18],[65,236,0],[58,0,10],[32,18],[65,229,0],[58,0,11],[32,18],[184],[33,15],[32,14],[252,3],[65,7],[32,15],[65,195,1],[16, ...builtin('__ecma262_ToPropertyKey')],[33,17],[252,3],[32,17],[16, ...builtin('__Porffor_object_get')],[33,24],[33,23],[32,11],[33,14],[32,15],[252,3],[34,18],[65,3],[54,1,0],[32,18],[65,231,0],[58,0,4],[32,18],[65,229,0],[58,0,5],[32,18],[65,244,0],[58,0,6],[32,18],[184],[33,15],[32,14],[252,3],[65,7],[32,15],[65,195,1],[16, ...builtin('__ecma262_ToPropertyKey')],[33,17],[252,3],[32,17],[16, ...builtin('__Porffor_object_get')],[33,26],[33,25],[32,11],[33,14],[32,15],[252,3],[34,18],[65,3],[54,1,0],[32,18],[65,243,0],[58,0,4],[32,18],[65,229,0],[58,0,5],[32,18],[65,244,0],[58,0,6],[32,18],[184],[33,15],[32,14],[252,3],[65,7],[32,15],[65,195,1],[16, ...builtin('__ecma262_ToPropertyKey')],[33,17],[252,3],[32,17],[16, ...builtin('__Porffor_object_get')],[33,28],[33,27],[68,0,0,0,0,0,0,0,0],[33,29],[32,25],[68,0,0,0,0,0,0,0,0],[98],[32,26],[65,128,1],[114],[65,128,1],[65,128,1],[114],[71],[114],[34,30],[69],[4,127],[32,27],[68,0,0,0,0,0,0,0,0],[98],[32,28],[65,128,1],[114],[65,128,1],[65,128,1],[114],[71],[114],[65,2],[33,6],[5],[32,30],[65,2],[33,6],[11],[4,64],[32,25],[68,0,0,0,0,0,0,0,0],[98],[32,26],[65,128,1],[114],[65,128,1],[65,128,1],[114],[71],[114],[34,30],[4,127],[32,25],[32,26],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,24,64],[98],[65,2],[33,6],[5],[32,30],[65,2],[33,6],[11],[4,64],...internalThrow(scope, 'TypeError', `Getter must be a function`),[11],[32,27],[68,0,0,0,0,0,0,0,0],[98],[32,28],[65,128,1],[114],[65,128,1],[65,128,1],[114],[71],[114],[34,30],[4,127],[32,27],[32,28],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,24,64],[98],[65,2],[33,6],[5],[32,30],[65,2],[33,6],[11],[4,64],...internalThrow(scope, 'TypeError', `Setter must be a function`),[11],[32,21],[68,0,0,0,0,0,0,0,0],[98],[32,22],[65,128,1],[114],[65,128,1],[65,128,1],[114],[71],[114],[34,30],[69],[4,127],[32,23],[68,0,0,0,0,0,0,0,0],[98],[32,24],[65,128,1],[114],[65,128,1],[65,128,1],[114],[71],[114],[65,2],[33,6],[5],[32,30],[65,2],[33,6],[11],[4,64],...internalThrow(scope, 'TypeError', `Descriptor cannot define both accessor and data descriptor attributes`),[11],[68,0,0,0,0,0,0,240,63],[33,29],[11],[68,0,0,0,0,0,0,0,0],[33,31],[32,29],[252,3],[4,64],[32,31],[68,0,0,0,0,0,0,240,63],[16, ...builtin('f64_|')],[33,31],[11],[32,12],[33,7],[32,13],[33,8],[2,127],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,7],[252,3],[40,1,0],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,7],[252,3],[40,1,0],[12,1],[11],[32,7],[252,3],[11,"TYPESWITCH_end"],[4,64],[32,31],[68,0,0,0,0,0,0,0,64],[16, ...builtin('f64_|')],[33,31],[11],[32,19],[33,7],[32,20],[33,8],[2,127],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,7],[252,3],[40,1,0],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,7],[252,3],[40,1,0],[12,1],[11],[32,7],[252,3],[11,"TYPESWITCH_end"],[4,64],[32,31],[68,0,0,0,0,0,0,16,64],[16, ...builtin('f64_|')],[33,31],[11],[32,23],[33,7],[32,24],[33,8],[2,127],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,7],[252,3],[40,1,0],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,7],[252,3],[40,1,0],[12,1],[11],[32,7],[252,3],[11,"TYPESWITCH_end"],[4,64],[32,31],[68,0,0,0,0,0,0,32,64],[16, ...builtin('f64_|')],[33,31],[11],[32,0],[252,2],[32,1],[32,9],[252,2],[32,10],[32,21],[32,22],[32,31],[252,2],[65,1],[16, ...builtin('__Porffor_object_define')],[33,6],[183],[26],[32,0],[32,1],[15]],
|
1694
1694
|
params: [124,127,124,127,124,127], typedParams: 1,
|
1695
1695
|
returns: [124,127], typedReturns: 1,
|
1696
|
-
locals: [127,124,127,124,127,124,124,127,124,124,127,127,127,124,127,124,127,124,127,124,127,124,127,124,
|
1696
|
+
locals: [127,124,127,124,127,124,124,127,124,124,127,127,127,124,127,124,127,124,127,124,127,124,127,124,127,124], localNames: ["target","target#type","prop","prop#type","descriptor","descriptor#type","#last_type","#logicinner_tmp","#typeswitch_tmp","p","p#type","desc","configurable","configurable#type","#member_obj","#member_prop","#loadArray_offset","#swap","#makearray_pointer_tmp","enumerable","enumerable#type","value","value#type","writable","writable#type","get","get#type","set","set#type","accessor","logictmpi","flags"],
|
1697
|
+
};
|
1698
|
+
this.__Object_defineProperties = {
|
1699
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isObject')],[33,4],[183],[33,5],[32,4],[33,6],[2,124],[32,6],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,6],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,5],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Target is a non-object`),[11],[32,2],[252,2],[32,3],[16, ...builtin('__Porffor_object_isObjectOrSymbol')],[33,4],[183],[33,5],[32,4],[33,6],[2,124],[32,6],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,6],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,5],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,5],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Props needs to be an object or symbol`),[11],[32,2],[252,3],[33,7],[65,0],[33,9],[32,7],[40,1,0],[34,8],[4,64],[32,3],[33,6],[2,64],[32,6],[65,7],[70],[4,64,"TYPESWITCH|Object"],[3,64],[32,7],[40,0,4],[34,12],[65,31],[118],[4,127],[32,12],[65,255,255,255,255,7],[113],[33,12],[65,67],[5],[65,195,1],[11],[33,11],[32,12],[184],[33,10],[2,64],[2,64],[32,0],[32,1],[32,10],[32,11],[32,2],[33,13],[32,10],[33,14],[32,3],[33,6],[2,124],[32,6],[65,7],[70],[4,64,"TYPESWITCH|Object"],[32,13],[252,3],[32,3],[32,14],[32,11],[16, ...builtin('__ecma262_ToPropertyKey')],[33,16],[252,3],[32,16],[16, ...builtin('__Porffor_object_get')],[33,4],[12,1],[11],[32,6],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[65,128,128,4],[65,1],[54,0,0],[65,128,128,4],[32,14],[252,3],[65,2],[108],[32,13],[252,3],[106],[47,0,4],[59,0,4],[68,0,0,0,0,0,0,240,64],[65,195,0],[33,4],[12,1],[11],[32,6],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,14],[252,3],[65,9],[108],[32,13],[252,3],[106],[34,15],[43,0,4],[32,15],[45,0,12],[33,4],[12,1],[11],[32,6],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[45,0,4],[184],[65,1],[33,4],[12,1],[11],[32,6],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[44,0,4],[183],[65,1],[33,4],[12,1],[11],[32,6],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[106],[45,0,4],[184],[65,1],[33,4],[12,1],[11],[32,6],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,4],[12,1],[11],[32,6],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,4],[12,1],[11],[32,6],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,4],[12,1],[11],[32,6],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,4],[12,1],[11],[32,6],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,4],[12,1],[11],[32,6],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[32,13],[252,3],[40,0,4],[32,14],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,4],[12,1],[11],[32,6],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[65,128,128,4],[65,1],[54,0,0],[65,128,128,4],[32,14],[252,3],[32,13],[252,3],[106],[45,0,4],[58,0,4],[68,0,0,0,0,0,0,240,64],[65,195,1],[33,4],[12,1],[11],...internalThrow(scope, 'TypeError', `Unsupported member expression object`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[32,4],[16, ...builtin('__Object_defineProperty')],[33,4],[26],[11],[32,7],[65,14],[106],[33,7],[32,9],[65,1],[106],[34,9],[32,8],[71],[13,1],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `Tried for..in on unsupported type`),[11,"TYPESWITCH_end"],[11],[32,0],[32,1],[15]],
|
1700
|
+
params: [124,127,124,127], typedParams: 1,
|
1701
|
+
returns: [124,127], typedReturns: 1,
|
1702
|
+
locals: [127,124,127,127,127,127,124,127,127,124,124,127,127], localNames: ["target","target#type","props","props#type","#last_type","#logicinner_tmp","#typeswitch_tmp","#forin_base_pointer","#forin_length","#forin_counter","x","x#type","#forin_tmp","#member_obj","#member_prop","#loadArray_offset","#swap"],
|
1697
1703
|
};
|
1698
1704
|
this.__Object_prototype_propertyIsEnumerable = {
|
1699
1705
|
wasm: (scope, {builtin}) => [[32,2],[32,3],[16, ...builtin('__ecma262_ToPropertyKey')],[33,5],[33,4],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[34,7],[68,0,0,0,0,0,0,28,64],[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,0,0,0,0,0,0,240,191],[97],[4,64],[68,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0],[65,128,1],[16, ...builtin('__Array_prototype_includes')],[34,6],[15]],
|
package/package.json
CHANGED