porffor 0.21.6 → 0.21.7
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 +35 -0
- package/compiler/generated_builtins.js +12 -0
- package/package.json +1 -1
- package/runner/index.js +1 -1
@@ -355,6 +355,41 @@ export const __Object_isFrozen = (obj: any): any => {
|
|
355
355
|
};
|
356
356
|
|
357
357
|
|
358
|
+
export const __Object_seal = (obj: any): any => {
|
359
|
+
// todo: support non-pure-objects
|
360
|
+
if (Porffor.rawType(obj) != Porffor.TYPES.object) {
|
361
|
+
return obj;
|
362
|
+
}
|
363
|
+
|
364
|
+
// make inextensible
|
365
|
+
Porffor.object.preventExtensions(obj);
|
366
|
+
|
367
|
+
// make all properties non-configurable
|
368
|
+
Porffor.object.overrideAllFlags(obj, 0b0000, 0b1101);
|
369
|
+
|
370
|
+
return obj;
|
371
|
+
};
|
372
|
+
|
373
|
+
export const __Object_isSealed = (obj: any): any => {
|
374
|
+
if (!Porffor.object.isObject(obj)) {
|
375
|
+
return true;
|
376
|
+
}
|
377
|
+
|
378
|
+
// todo: support non-pure-objects
|
379
|
+
if (Porffor.rawType(obj) != Porffor.TYPES.object) {
|
380
|
+
return false;
|
381
|
+
}
|
382
|
+
|
383
|
+
// check obj is inextensible
|
384
|
+
if (!Porffor.object.isInextensible(obj)) {
|
385
|
+
return false;
|
386
|
+
}
|
387
|
+
|
388
|
+
// check all properties are non-configurable
|
389
|
+
return Porffor.object.checkAllFlags(obj, 0b0010, 0b0010, 0, 0);
|
390
|
+
};
|
391
|
+
|
392
|
+
|
358
393
|
export const __Object_prototype_toString = (_this: object) => {
|
359
394
|
let out: bytestring = '[object Object]';
|
360
395
|
return out;
|
@@ -1767,6 +1767,18 @@ export const BuiltinFuncs = function() {
|
|
1767
1767
|
returns: [124,127], typedReturns: 1,
|
1768
1768
|
locals: [127,124,127], localNames: ["obj","obj#type","#last_type","#logicinner_tmp","#typeswitch_tmp"],
|
1769
1769
|
};
|
1770
|
+
this.__Object_seal = {
|
1771
|
+
wasm: (scope, {builtin}) => [[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,28,64],[98],[4,64],[32,0],[32,1],[15],[11],[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_preventExtensions')],[26],[183],[26],[32,0],[252,2],[32,1],[65,0],[65,1],[65,13],[65,1],[16, ...builtin('__Porffor_object_overrideAllFlags')],[26],[183],[26],[32,0],[32,1],[15]],
|
1772
|
+
params: [124,127], typedParams: 1,
|
1773
|
+
returns: [124,127], typedReturns: 1,
|
1774
|
+
locals: [127], localNames: ["obj","obj#type","#last_type"],
|
1775
|
+
};
|
1776
|
+
this.__Object_isSealed = {
|
1777
|
+
wasm: (scope, {builtin}) => [[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isObject')],[33,2],[183],[33,3],[32,2],[33,4],[2,124],[32,4],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,4],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[68,0,0,0,0,0,0,240,63],[65,2],[15],[11],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,28,64],[98],[4,64],[68,0,0,0,0,0,0,0,0],[65,2],[15],[11],[32,0],[252,2],[32,1],[16, ...builtin('__Porffor_object_isInextensible')],[33,2],[183],[33,3],[32,2],[33,4],[2,124],[32,4],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,4],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[68,0,0,0,0,0,0,0,0],[65,2],[15],[11],[32,0],[252,2],[32,1],[65,2],[65,1],[65,2],[65,1],[65,0],[65,1],[65,0],[65,1],[16, ...builtin('__Porffor_object_checkAllFlags')],[33,2],[183],[32,2],[15]],
|
1778
|
+
params: [124,127], typedParams: 1,
|
1779
|
+
returns: [124,127], typedReturns: 1,
|
1780
|
+
locals: [127,124,127], localNames: ["obj","obj#type","#last_type","#logicinner_tmp","#typeswitch_tmp"],
|
1781
|
+
};
|
1770
1782
|
this.__Object_prototype_toString = {
|
1771
1783
|
wasm: (scope, {allocPage}) => [...number(allocPage(scope, 'bytestring: __Object_prototype_toString/out', 'i8') * pageSize, 124),[34,2],[65,195,1],[15]],
|
1772
1784
|
params: [124,127], typedParams: 1,
|
package/package.json
CHANGED