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.
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.21.6+e77e4f0cb",
4
+ "version": "0.21.7+0f277b026",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.21.6+e77e4f0cb';
3
+ globalThis.version = '0.21.7+0f277b026';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {