@@ -1165,16 +1165,18 @@ class ParserBase {
11651165 }
11661166 bool is_using_allowed () const {
11671167 // UsingDeclaration and AwaitUsingDeclaration are Syntax Errors if the goal
1168- // symbol is Script. UsingDeclaration and AwaitUsingDeclaration are not
1169- // contained, either directly or indirectly, within a Block, CaseBlock,
1170- // ForStatement, ForInOfStatement, FunctionBody, GeneratorBody,
1168+ // symbol is Script. UsingDeclaration and AwaitUsingDeclaration are Syntax
1169+ // Errors if they are not contained, either directly or indirectly, within a
1170+ // Block, ForStatement, ForInOfStatement, FunctionBody, GeneratorBody,
11711171 // AsyncGeneratorBody, AsyncFunctionBody, ClassStaticBlockBody, or
1172- // ClassBody. Unless the current scope's ScopeType is ScriptScope, the
1172+ // ClassBody. They are disallowed in 'bare' switch cases.
1173+ // Unless the current scope's ScopeType is ScriptScope, the
11731174 // current position is directly or indirectly within one of the productions
11741175 // listed above since they open a new scope.
1175- return ((scope ()->scope_type () != SCRIPT_SCOPE &&
1176- scope ()->scope_type () != EVAL_SCOPE) ||
1177- scope ()->scope_type () == REPL_MODE_SCOPE);
1176+ return (((scope ()->scope_type () != SCRIPT_SCOPE &&
1177+ scope ()->scope_type () != EVAL_SCOPE) ||
1178+ scope ()->scope_type () == REPL_MODE_SCOPE) &&
1179+ !scope ()->is_nonlinear ());
11781180 }
11791181 bool IsNextUsingKeyword (Token::Value token_after_using, bool is_await_using) {
11801182 // using and await using declarations in for-of statements must be followed
0 commit comments