Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/oxc_semantic/src/checker/javascript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ pub fn check_for_statement_left(
pub fn check_for_of_statement(stmt: &ForOfStatement, ctx: &SemanticBuilder<'_>) {
// ClassStaticBlockBody : ClassStaticBlockStatementList
// It is a Syntax Error if ClassStaticBlockStatementList Contains await is true.
if stmt.r#await && ctx.scoping.scope_flags(ctx.current_scope_id).is_class_static_block() {
if stmt.r#await && is_in_class_static_block(ctx) {
ctx.error(diagnostics::class_static_block_for_await(stmt.span));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class C {
static {
{
for await (const x of y) {}
}
}
}
10 changes: 9 additions & 1 deletion tasks/coverage/snapshots/parser_misc.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parser_misc Summary:
AST Parsed : 65/65 (100.00%)
Positive Passed: 65/65 (100.00%)
Negative Passed: 134/134 (100.00%)
Negative Passed: 135/135 (100.00%)

× Cannot assign to 'arguments' in strict mode
╭─[misc/fail/arguments-eval.ts:1:10]
Expand Down Expand Up @@ -3807,6 +3807,14 @@ Negative Passed: 134/134 (100.00%)
╰────
help: Wrap this code in a block or use a module

× Cannot use 'for await' in class static initialization block
╭─[misc/fail/semantic-for-await-in-block-in-static-block.mjs:4:7]
3 │ {
4 │ for await (const x of y) {}
· ───────────────────────────
5 │ }
╰────

× Expected switch clause
╭─[misc/fail/switch-invalid-clause.js:2:3]
1 │ switch (foo) {
Expand Down
Loading