@@ -6609,7 +6609,7 @@ namespace ts {
6609
6609
while (current && !nodeStartsNewLexicalEnvironment(current)) {
6610
6610
if (isIterationStatement(current, /*lookInLabeledStatements*/ false)) {
6611
6611
if (inFunction) {
6612
- grammarErrorOnFirstToken (current, Diagnostics.Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher, declarationNameToString(node)) ;
6612
+ getNodeLinks (current).flags |= NodeCheckFlags.LoopWithBlockScopedBindingCapturedInFunction ;
6613
6613
}
6614
6614
// mark value declaration so during emit they can have a special handling
6615
6615
getNodeLinks(<VariableDeclaration>symbol.valueDeclaration).flags |= NodeCheckFlags.BlockScopedBindingInLoop;
@@ -14580,6 +14580,10 @@ namespace ts {
14580
14580
14581
14581
// Emitter support
14582
14582
14583
+ function isArgumentsLocalBinding(node: Identifier): boolean {
14584
+ return getReferencedValueSymbol(node) === argumentsSymbol;
14585
+ }
14586
+
14583
14587
// When resolved as an expression identifier, if the given node references an exported entity, return the declaration
14584
14588
// node of the exported entity's container. Otherwise, return undefined.
14585
14589
function getReferencedExportContainer(node: Identifier): SourceFile | ModuleDeclaration | EnumDeclaration {
@@ -14884,7 +14888,8 @@ namespace ts {
14884
14888
collectLinkedAliases,
14885
14889
getReferencedValueDeclaration,
14886
14890
getTypeReferenceSerializationKind,
14887
- isOptionalParameter
14891
+ isOptionalParameter,
14892
+ isArgumentsLocalBinding
14888
14893
};
14889
14894
}
14890
14895
@@ -15711,21 +15716,6 @@ namespace ts {
15711
15716
}
15712
15717
}
15713
15718
15714
- function isIterationStatement(node: Node, lookInLabeledStatements: boolean): boolean {
15715
- switch (node.kind) {
15716
- case SyntaxKind.ForStatement:
15717
- case SyntaxKind.ForInStatement:
15718
- case SyntaxKind.ForOfStatement:
15719
- case SyntaxKind.DoStatement:
15720
- case SyntaxKind.WhileStatement:
15721
- return true;
15722
- case SyntaxKind.LabeledStatement:
15723
- return lookInLabeledStatements && isIterationStatement((<LabeledStatement>node).statement, lookInLabeledStatements);
15724
- }
15725
-
15726
- return false;
15727
- }
15728
-
15729
15719
function checkGrammarBreakOrContinueStatement(node: BreakOrContinueStatement): boolean {
15730
15720
let current: Node = node;
15731
15721
while (current) {
0 commit comments