This completes the work that started in PR #33069, and fixes#32835.
There are probably two additional related changes that are needed to
make this more complete:
* Fix the code that composes the error message (see the first two
`FIXME`s in `callWithSpread3.ts`).
* Fix the code that checks the argument types (second two `FIXME`s).
* There is also an error in `genericRestParameters1.ts` which changed
but should not be an error in the first place. Added a `FIXME` there
too. (Probably will work if the previous iterm is done.)
In addition, `getEffectiveCallArguments` munges the arguments in case of
a spread in the last argument which might be better to avoid. (I think
that there are cases where it wouldn't work anyway, such as a spread of
an array followed by a spread of an empty array.)
Fix#14026, where ES5 emit for a parameter with
1. a default value initialiser
2. an object binding pattern containing an object rest
incorrectly emitted the destructuring for the object rest before the
default value initialisation.
This happened because, during emit, the ES next transform runs first,
transforming object rest destructuring and marking it as part of the
function prologue. Then the ES5 transform runs and transforms the
default initialiser, also marking it as part of the prologue. Then the
prologue is emitted in the order the statements were added.
The fix is to not mark the object rest destructuring as part of the
prologue. I'm not 100% sure that this is the right fix, but it fixes the
bug as it stands today.
Here's an example:
```ts
function foobar({ bar={}, ...opts }: any = {}) { }
```
which should have the ES5 emit:
```js
function foobar(_a) {
if (_a === void 0) { _a = {}; }
var _b = _a.bar, bar = _b === void 0 ? {} : _b, opts = __rest(_a, ["bar"]);
}
```