oxc/crates/oxc_traverse/scripts/lib
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
..
ancestor.mjs refactor(ast): store ScopeId in AST nodes (#3302) 2024-05-16 16:21:17 +00:00
parse.mjs refactor(traverse): indicate scope entry point with scope(enter_before) attr (#3882) 2024-06-24 14:12:15 +00:00
traverse.mjs feat(traverse): pass &mut TraverseCtx to visitors (#3312) 2024-05-16 16:21:23 +00:00
utils.mjs refactor(traverse): simplify build script (#3231) 2024-05-11 09:03:16 +01:00
walk.mjs refactor(traverse): use camel case props internally (#3880) 2024-06-24 13:19:34 +00:00