closes#949closes#950closes#951
All minifier tests are disable from this PR.
We are going to fix the compilation errors first, then the behavioral
errors.
This PR introduces the oxc transformer.
The code is purposely arranged without any Rust trickery such as traits
and macros.
I intend to keep the code style this way until something blows up.
The next steps are:
* unit tests
* conformance tests with TypeScript and Babel
* benchmarks
closes#273closes#814
HIR is removed from this PR, with the minifier being commented out.
HIR is a wonderful idea for compiling to lower languages, but after
sitting on it for a few months I found that it only adds confusion and
uncertainties to both myself and future contributors.
It also adds too much burden to maintainers if we plan to support more
downstream tools.
1 AST is the only way.
When initially written types were not in the symbol table. Now that
types are in the symbol table it makes sense given
```ts
type A = 1
type B = A
```
that you can get to the symbol id for for A from type B = A.
Please correct me if I'm wrong about how I implemented this. I also
verified that occurrence (I believe this is the correct word) behaves
how I would expect.
```ts
type RecursiveType = string | {[x: string]: RecursiveType}
```
Does populate a reference.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
The main reason is using Atom to remove the lifetime for convenience.
And after removing the lifetime of these nodes, the `Program<'a>`
doesn't rely on `&'a source` anymore, which allows us to [specify more
accurate
lifetimes](https://github.com/web-infra-dev/oxc/discussions/700).
Fixes 11 TS conformance tests and 18 babel tests.
Adds types to the symbol table functionally conformant to TS behavior
but symbol flags implemented slightly differently.
Symbol redeclaration check is also not entirely conformant but fixing
this seems like a separate PR.
For testing purposes - consistent-export-type was also implemented
(WIP).
Adds `AstKind::debug_name()`, which returns the name of an AstKind
struct with a few minor details as applicable. I intentionally did not
make `AstKind` implement `Display`, as this method returns minimal
information. Additionally, this method only exists in debug builds. I've
hidden it behind a `#[cfg(debug_assertions)]`, so it won't affect
release builds.
This code was extracted from #642, where it as created while debugging
iteration over ancestor nodes. I figured it belonged in its own PR and
may be useful to other devs.
Reduces mallocs via `clones()` (particularly of `Atom`s), and vec
allocations.
Affects the following rules:
- [x] eslint/no-dupe-keys
- [x] eslint/no-global-assign
- [x] eslint/no-loss-of-precision _(only partially optimized, needs more
work later)_
~- [ ] typescript-eslint/ajacent-overload-signatures~ (_will be
addressed in following pr_)