This pr introduces some cargo features. For `swc_common` and `swc_ecma_ast`, it introduces a feature flag `fold`.
`Fold` and `Visit` traits exist only if the feature is enabled.
For `swc_ecma_parser`, flag called `verify` is added. When disabled, we skip checking of validity of some expressions.
e.g. `{foo = bar}`
Verification is disabled by default it requires nightly compiler
swc_atoms:
- add some atoms
swc_ecma_ast:
- ast nodes for typescript
- `ClassMethod` -> `Method`, `ClassMethodKind` -> `MethodKind`
- private class method / class property
- use separate type for tagged template literals
- add `declare` field to `Decl`s
- make function body optional
swc_ecma_parser:
- rename Type to TokenContext
- support decorators
Note: error reporting for invalid decorator is not implemented yet
- merge `Config` into `Syntax`
- Use DiagnosticBuilder for error type
This is to make backtracking cheaper.
swc_ecma_transforms:
- add `strip` pass
105: Fix old proc_macros2 dep breaking compile and fix line endings in atoms r=kdy1 a=isavegas
When trying to compile swc, I came across an issue with [proc_macro2::Span::join(&self, other: Span) -> Option\<Span\>](https://docs.rs/proc-macro2/0.4.24/proc_macro2/struct.Span.html#method.join) not existing. Easily fixed by updating the dependency from `0.4.4` to `0.4.24`.
Another major issue I came across when compiling the crate involved the `js_word!` macro throwing an error due to not accepting any parameters. After digging around, I noticed that the `js_word.rs` file that is generated by `atoms`' `build.rs` contained trailing `\r`s. As it turns out, the call to `::split(&'static str)` was allowing carriage returns to propagate to the aforementioned `js_word.rs` file. Replaced with a call to `::lines()` and a `map` to trim the words, just in case.
Co-authored-by: Leviathan Jeanis <isavegas2006@gmail.com>