string_enum:
- #[derive(StringEnum)] now derives `Deserialize`
swc_ecma_ast:
- implement deserialize for ast nodes.
- change ast to make it serialized / deserialized correctly
swc_ecma_parser:
- jsx, test262, typescript tests now verify serialization and deserialization of module
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_common:
- update rustc-ap crates to v313
swc_ecma_ast:
- use bool instead of Option<Span>
swc_ecma_parser:
- remove LexerInput
- use uncons_while
- assert only on debug mode
- use Visit instead of Fold while verifying
- replace debug! with trace!
- disable logging while benchmarking
- drop slog
swc_ecma_transforms:
- classes: fold Decl instead of Stmt
swc:
- add nodejs binding
`Map<T>` adds a method named `map` which is actually `Box<T>` -> `Box<T>` without reallocation.
swc_ecma_transforms:
- chain_at!(Type, passes)
This macro deeply joins path at 'Type' level.
swc_common:
- implement VisitWith for &T and [T]
swc_ecma_ast:
- fix codegen of `===`
swc_ecma_parser:
- fix parsing of array pattern
swc_ecma_transforms:
- implement es2015::destructuring
- implement es2015::computed_properties
- implement es2015::duplicate_keys
- implement es2015::parameters
- fix `InjectHelper` pass
Note that getters / setters in class are not supported yet
- Run execution tests via jest
- ignore es2016::exponentation tests
ecma_transforms:
- implement es2015::instanceof
- implement es2015::typeof_symbol
- implement inline_globals pass
ecma_parser:
- `PResult<T>` is now `Result<T, ()>` and `Err(())` means that an error is emitted.
- add docs
- rename packages to be consistent
- `swc_macros` is removed. Now macros are imported with `extern crate macro_name` instead of `extern crate swc_macros`.
- manage atoms with words.txt file
* constructor codegen
* Update string_cache to 0.7
* make swc_common not depend on sourcemap
* Remove unused dependencies
* update either to 1.5.0
* update rustc-ap crates to 297
* remove unused dependency (fnv)
common:
- rename `Folder` to `Fold`
- folder.then()
- impl Fold for Box<F>
- impl Fold<T> for &mut F where F: Fold<T>
transforms:
- make Simplifier private
- organize compat
codegen:
- use `Mark` to avoid deoptimization
swc:
- upgrade rayon and use global thread pool instead
* `struct Expr` + `enum ExprKind` -> `enum Expr`
`Expr` / `ExprKind` approach does not work well with recursive
processing based on the type system because we can't access common
fields like span while processing child node like `MemberExpr`.
As ast processing is inherently recursive, we should use a
recursive-friendly approach.
* `#[derive(FromVariants)]`
It creates lots of `From<T>` to help using ast enums as a real sum type.
* `#[derive(Spanned)]`
Inspired by https://docs.rs/syn/0.12.13/syn/spanned/trait.Spanned.html
It does not handle attributes yet.
* Parser is not updated yet.
- Make rls happy.
- Some minor parser error improvements.
- Add reference files for ecmascript parser errors.
- Improve error message of import/export used outside of a module
rust-analysis chokes with `Option<Box<Expr>>` style fields.
Rls only shows a warning on the crate with that fields, but ICEs on
dependent crates.
This can be workarounded by using `Option<(Box<Expr>)>`.
Also, using multiple glob imports is bad for rls.
So this commit deglobs them.
* Remove CanIUse trait, which will be reimpplemented in future
using Visitor.
* Remove some other unused stuffs.
* Change public path of swc_common::fold::* to swc_common::*.
- Parser and lexer for lastest ecma spec https://tc39.github.io/ecma262
- Lexer is currently very inefficient
- Use https://github.com/tc39/test262-parser-tests/ for testing.
- Implement proc-macro based ast folder and assert_eq_ignore_span! based on it.
- Some utilities for proc macro at /macros/common