oxc/crates/oxc_traverse
overlookmotel fcd21a6a75 refactor(traverse): indicate scope entry point with scope(enter_before) attr (#3882)
Improve annotation of AST types for codegen.

Currently:

```rs
#[visited_node(
    scope(ScopeFlags::empty()),
    enter_scope_before(cases),
)]
pub struct SwitchStatement<'a> {
    pub span: Span,
    pub discriminant: Expression<'a>,
    pub cases: Vec<'a, SwitchCase<'a>>,
    pub scope_id: Cell<Option<ScopeId>>,
}
```

After this PR:

```rs
#[visited_node(scope(ScopeFlags::empty()))]
pub struct SwitchStatement<'a> {
    pub span: Span,
    pub discriminant: Expression<'a>,
    #[scope(enter_before)]
    pub cases: Vec<'a, SwitchCase<'a>>,
    pub scope_id: Cell<Option<ScopeId>>,
}
```

I think this is easier to read.

In order to enable use of `#[scope]` attr, this introduces a dummy `VisitedNode` derive macro. Like the `visited_node` macro, `VisitedNode` derive macro is designed to do very minimal work and have no heavy dependencies, so it should be almost 0 cost in terms of compile time.
2024-06-24 14:12:15 +00:00
..
scripts refactor(traverse): indicate scope entry point with scope(enter_before) attr (#3882) 2024-06-24 14:12:15 +00:00
src refactor(ast): add span field to the BindingPattern type. (#3855) 2024-06-23 16:00:40 +00:00
tests feat(traverse): pass &mut TraverseCtx to visitors (#3312) 2024-05-16 16:21:23 +00:00
build.rs fix(traverse): do not publish the build script 2024-06-08 16:31:21 +08:00
Cargo.toml chore: do not compile test crates that have no tests 2024-06-24 00:20:04 +08:00
CHANGELOG.md Release crates v0.15.0 (#3743) 2024-06-19 01:15:55 +08:00