porffor 0.37.25 → 0.37.26

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.
@@ -532,6 +532,24 @@ export const __Object_defineProperty = (target: any, prop: any, desc: any) => {
532
532
  if (!Porffor.object.isObject(target)) throw new TypeError('Target is a non-object');
533
533
  if (!Porffor.object.isObject(desc)) throw new TypeError('Descriptor is a non-object');
534
534
 
535
+ if (Porffor.rawType(target) == Porffor.TYPES.array) {
536
+ const tmp1: bytestring = 'length';
537
+ const tmp2: bytestring = 'value';
538
+ if (prop === tmp1 && __Object_hasOwn(desc, tmp2)) {
539
+ const v: any = desc.value;
540
+ const n: number = ecma262.ToNumber(v);
541
+ if (Porffor.fastOr(
542
+ Number.isNaN(n), // NaN
543
+ Math.floor(n) != n, // non integer
544
+ n < 0, // negative
545
+ n >= 4294967296, // > 2**32 - 1
546
+ )) throw new RangeError('Invalid array length');
547
+
548
+ // set real array length
549
+ Porffor.wasm.i32.store(target, n, 0, 0);
550
+ }
551
+ }
552
+
535
553
  const p: any = ecma262.ToPropertyKey(prop);
536
554
 
537
555
  // base keys