Commit Graph

56 Commits

Author SHA1 Message Date
overlookmotel 62c3a4a576 style(ast_tools): add full stop to end of generated comments (#10809) 2025-05-05 12:52:20 +01:00
overlookmotel 3b6d52d009 refactor(napi/parser): move generated deserializer files (#10481)
Pure refactor. Move generated deserializer files for `napi/parser` into a `generated/deserialize` directory. This is to make room for more generated files (e.g. visitor, more specialized deserializers), without the number of file in root of the package exploding.
2025-04-29 10:30:27 +01:00
overlookmotel d43e8642eb refactor(ast_tools): generate ChildScopesCollector in oxc_ast_tools (#10248)
Reimplement the codegen for `ChildScopesCollector` visitor in Rust in `oxc_ast_tools`. First step towards #9702.
2025-04-04 21:27:24 +00:00
Boshen d82dff91c8 feat(formatter): new implementation based on biome formatter (#10108)
Part of #5068, suggested by @ematipico and @MichaReiser, where @leaysgur
and I explored using biome formatter as the base and made a success. All
credits to the old Rome and the new Biome team.

This PR is in a boilerplate state where some of the functions are marked
as `todo!()`.

I also made the following changes:

* changed the base to be less generic, removed the `Language` and
`Context` generics
* expanded the formatter lifetime to include an `'ast` lifetime
* added access to the source text and comments
* added a mechanism for tracking and accessing parent ast nodes (done by
our codegen)
* removed most of the unit tests because they no longer compile
* removed the `oxc_prettier` crate
2025-03-30 16:54:37 +08:00
overlookmotel 8cd7430206 feat(allocator): TakeIn trait (#9969)
Add 2 traits and implement them for AST types:

* `Dummy` trait creates a dummy node for an AST type.
* `TakeIn` replaces a node with a dummy.

Reason for 2 separate traits is that for some types we need to implement `Dummy`, but it'd be inappropriate to implement `TakeIn`. e.g.:

* Fieldless enums which are `Copy`: They should just be copied, rather than replaced.
* `Span`: Ditto.
* `Box<T>`: You should replace the *contents* of the `Box`, not the `Box` itself.

Ideally we wouldn't be implementing `TakeIn` for so many types. Some types are very expensive to generate a dummy for, so we'd ideally guide consumers away from that by not implementing `TakeIn` for those types.

But we want to replace the `TakeIn` trait in Rolldown with our own version. Because Rolldown implements `TakeIn` on many many types, it seemed to make sense to codegen `TakeIn` for pretty much all AST types, so we can migrate their code over to using our trait without too much hassle.
2025-03-24 10:30:45 +00:00
overlookmotel a59b9fe4cb ci(ast_tools): move AST changes watch list file (#9564)
Pure refactor. Move the YAML file for AST changes watch list to a `generated` sub-directory. This follows our convention that all generated files go in a `generated` directory.
2025-03-05 13:22:59 +00:00