porffor 0.61.7 → 0.61.8
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/array.ts +5 -4
- package/compiler/builtins_precompiled.js +428 -428
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/runtime/index.js +1 -1
|
@@ -64,8 +64,9 @@ export const __Array_from = (arg: any, mapFn: any, thisArg: any = undefined): an
|
|
|
64
64
|
return out;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
if (
|
|
68
|
-
|
|
67
|
+
if (__Porffor_object_isObject(arg)) {
|
|
68
|
+
const obj: object = Porffor.type(arg) == Porffor.TYPES.object ? arg : __Porffor_object_underlying(arg);
|
|
69
|
+
let len: i32 = ecma262.ToIntegerOrInfinity(obj['length']);
|
|
69
70
|
if (len > 4294967295) throw new RangeError('Invalid array length');
|
|
70
71
|
if (len < 0) len = 0;
|
|
71
72
|
|
|
@@ -73,11 +74,11 @@ export const __Array_from = (arg: any, mapFn: any, thisArg: any = undefined): an
|
|
|
73
74
|
if (Porffor.type(mapFn) != Porffor.TYPES.function) throw new TypeError('Called Array.from with a non-function mapFn');
|
|
74
75
|
|
|
75
76
|
for (let i: i32 = 0; i < len; i++) {
|
|
76
|
-
out[i] = mapFn.call(thisArg,
|
|
77
|
+
out[i] = mapFn.call(thisArg, obj[i], i);
|
|
77
78
|
}
|
|
78
79
|
} else {
|
|
79
80
|
for (let i: i32 = 0; i < len; i++) {
|
|
80
|
-
out[i] =
|
|
81
|
+
out[i] = obj[i];
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|