|
1096 | 1096 |
|
1097 | 1097 | var ArrayPrototypeShims = { |
1098 | 1098 | copyWithin: function copyWithin(target, start) { |
1099 | | - var end = arguments[2]; // copyWithin.length must be 2 |
| 1099 | + // copyWithin.length must be 2, so we can't add `end` to the arguments |
| 1100 | + // directly. |
| 1101 | + var end = arguments.length > 2 ? arguments[2] : void 0; |
1100 | 1102 | var o = ES.ToObject(this); |
1101 | 1103 | var len = ES.ToLength(o.length); |
1102 | 1104 | var relativeTarget = ES.ToInteger(target); |
|
1243 | 1245 | if (!arrayFromHandlesUndefinedMapFunction) { |
1244 | 1246 | var origArrayFrom = Array.from; |
1245 | 1247 | overrideNative(Array, 'from', function from(items) { |
1246 | | - if (arguments.length > 0 && typeof arguments[1] !== 'undefined') { |
| 1248 | + if (arguments.length > 1 && typeof arguments[1] !== 'undefined') { |
1247 | 1249 | return ES.Call(origArrayFrom, this, arguments); |
1248 | 1250 | } else { |
1249 | 1251 | return _call(origArrayFrom, this, items); |
|
2442 | 2444 | if (!ES.IsPromise(promise)) { throw new TypeError('not a promise'); } |
2443 | 2445 | var C = ES.SpeciesConstructor(promise, Promise); |
2444 | 2446 | var resultCapability; |
2445 | | - var returnValueIsIgnored = (arguments[2] === PROMISE_FAKE_CAPABILITY); |
| 2447 | + var returnValueIsIgnored = (arguments.length > 2 && arguments[2] === PROMISE_FAKE_CAPABILITY); |
2446 | 2448 | if (returnValueIsIgnored && C === Promise) { |
2447 | 2449 | resultCapability = PROMISE_FAKE_CAPABILITY; |
2448 | 2450 | } else { |
|
3302 | 3304 | if (!ES.IsConstructor(constructor)) { |
3303 | 3305 | throw new TypeError('First argument must be a constructor.'); |
3304 | 3306 | } |
3305 | | - var newTarget = arguments.length < 3 ? constructor : arguments[2]; |
| 3307 | + var newTarget = arguments.length > 2 ? arguments[2] : constructor; |
3306 | 3308 | if (!ES.IsConstructor(newTarget)) { |
3307 | 3309 | throw new TypeError('new.target must be a constructor.'); |
3308 | 3310 | } |
|
0 commit comments