porffor 0.58.4 → 0.58.6

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.
@@ -425,7 +425,7 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
425
425
 
426
426
  // encode call indirect ops as types from info
427
427
  if (op === Opcodes.call_indirect) {
428
- const params = [];
428
+ const params = [ Valtype.i32 ];
429
429
  for (let i = 0; i < o[1]; i++) {
430
430
  params.push(valtypeBinary, Valtype.i32);
431
431
  }
@@ -536,7 +536,7 @@ export const __Array_prototype_findIndex = (_this: any[], callbackFn: any, thisA
536
536
  };
537
537
 
538
538
  // @porf-typed-array
539
- export const __Array_prototype_findLastIndex = (_this: any[], callbackF: any, thisArg: any) => {
539
+ export const __Array_prototype_findLastIndex = (_this: any[], callbackFn: any, thisArg: any) => {
540
540
  let i: i32 = _this.length;
541
541
  while (i > 0) {
542
542
  if (!!callbackFn.call(thisArg, _this[--i], i, _this)) return i;
@@ -1141,6 +1141,9 @@ export const __Date_prototype_setSeconds = (_this: any, sec: any, ms: any) => {
1141
1141
  export const __Date_prototype_setTime = (_this: any, time: any) => {
1142
1142
  // 1. Let dateObject be the this value.
1143
1143
  // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]).
1144
+ // extra check here to check ensure this type before coerce as only function where coerce is done before any true read
1145
+ if (Porffor.type(_this) != Porffor.TYPES.date) throw TypeError('Date prototype methods require this to be a Date object');
1146
+
1144
1147
  // 3. Let t be ? ToNumber(time).
1145
1148
  const t: number = ecma262.ToNumber(time);
1146
1149
 
@@ -1383,7 +1386,7 @@ export const __Date_prototype_setUTCSeconds = (_this: any, sec: any, ms: any) =>
1383
1386
  // 5. If ms is present, let milli be ? ToNumber(ms).
1384
1387
  let milli: number;
1385
1388
  if (Porffor.type(ms) != Porffor.TYPES.undefined) milli = ecma262.ToNumber(ms);
1386
-
1389
+
1387
1390
  // 6. If t is NaN, return NaN.
1388
1391
  if (Number.isNaN(t)) return NaN;
1389
1392