**Description:**
This does not support
```js
class Foo extends Bar {
constructor() {
for (const i of [1]) {
setTimeout(() => {
console.log(this)
});
}
super();
}
}
```
but it does not seem to be used in a real-world code.
**Related issue:**
- Closes#8300
- Closes#8311
**Description:**
At some point the spec text of ES decorators was changed to also have
addInitializer for field decorators. This is already used e.g. in mobx.
This simple change removes the special case that was present for field
decorators and seems to fix the issue for me.
This change is backwards compatible since it only affects code that was
broken before.
**Related issue:**
- Closes#8525
**Description:**
Directives should be at the start of the file, and this PR changes the parser to match only at the start of a file.
**Related issue:**
- Closes#8616.
**Description:**
- The option `hoist_props` now does what it's supposed to do.
- Dropping of unused properties now does not drop properties too aggressively.
- The initializer of a dropped variable declaration is now properly visited.
- Indexing with string literals is not marked as a dynamic index anymore. This is required to handle codes like c3f67ceb1e/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_1/input.js (L1-L7).
**Description:**
The related issue is a product to the fact that the lexer sees a `<<`
token in `fun<<T>...` and therefore parses the type args as an arrow
function.
This PR adds the handling of the "split" of `<<` when beginning to parse
type args.
I am open for suggestions, I still find this a bit odd (in
`parse_ts_type_args()`):
```rs
if is!(p, "<<") {
p.input.cut_lshift();
} else {
expect!(p, '<');
}
```
**Related issue:**
- Closes#7187
- Closes#8209
- Closes#8581