mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 02:06:08 +03:00
bfea322351
**Description:** This PR addresses the issue described in https://github.com/swc-project/swc/issues/8713 **BREAKING CHANGE:** Will break unit tests that use `fold_module`/`visit_module`/`visit_mut_module` if the visitor is intended to work for both modules and scripts instead of using `fold_program`/`visit_program`/`visit_mut_program`. When creating visitors, you should use `fold_program`/`visit_program`/`visit_mut_program` if you simply want to visit the top-level node. When creating tests, the input source code will be parsed using `parse_program` by default. If you need to parse it as a `Module`, you can use `module: Some(true)` in `FixtureTestConfig` (or with `test!(module, ..)`), which will parse it as a `Program::Module`, or `Some(false)` for `Program::Script`. `None` will use `parse_program` (`parse_program` will auto-detect the underlying type). |
||
---|---|---|
.. | ||
scripts | ||
src | ||
tests | ||
Cargo.toml |