mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
fb181ccdff
## Summary - Add check to error on `using` declarations at the top level of scripts - `using` declarations require block scope semantics and are not allowed at the top level of scripts `using` declarations are allowed: - At the top level of ES modules - At the top level of CommonJS modules (files are wrapped in a function) - Inside any block scope in scripts But NOT at the top level of scripts. Closes #11862 ## Test plan - [x] Added test case `tasks/coverage/misc/fail/script-top-level-using.js` for invalid usage - [x] Added test case `tasks/coverage/misc/pass/script-using-in-block.js` for valid usage in block - [x] All existing tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
5 lines
67 B
JavaScript
5 lines
67 B
JavaScript
// 'using' is allowed inside blocks in scripts
|
|
{
|
|
using x = {};
|
|
}
|