@@ -52856,17 +52856,28 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
5285652856 }
5285752857
5285852858 const blockScopeFlags = declarationList.flags & NodeFlags.BlockScoped;
52859- if ((blockScopeFlags === NodeFlags.Using || blockScopeFlags === NodeFlags.AwaitUsing) && isForInStatement(declarationList.parent)) {
52860- return grammarErrorOnNode(
52861- declarationList,
52862- blockScopeFlags === NodeFlags.Using ?
52863- Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration :
52864- Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration,
52865- );
52866- }
52859+ if (blockScopeFlags === NodeFlags.Using || blockScopeFlags === NodeFlags.AwaitUsing) {
52860+ if (isForInStatement(declarationList.parent)) {
52861+ return grammarErrorOnNode(
52862+ declarationList,
52863+ blockScopeFlags === NodeFlags.Using ?
52864+ Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration :
52865+ Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration,
52866+ );
52867+ }
5286752868
52868- if (blockScopeFlags === NodeFlags.AwaitUsing) {
52869- return checkAwaitGrammar(declarationList);
52869+ if (declarationList.flags & NodeFlags.Ambient) {
52870+ return grammarErrorOnNode(
52871+ declarationList,
52872+ blockScopeFlags === NodeFlags.Using ?
52873+ Diagnostics.using_declarations_are_not_allowed_in_ambient_contexts :
52874+ Diagnostics.await_using_declarations_are_not_allowed_in_ambient_contexts,
52875+ );
52876+ }
52877+
52878+ if (blockScopeFlags === NodeFlags.AwaitUsing) {
52879+ return checkAwaitGrammar(declarationList);
52880+ }
5287052881 }
5287152882
5287252883 return false;
0 commit comments