Local declarations don't mutate captured outer variables

This commit is contained in:
Anders Hejlsberg
2024-06-05 15:43:11 -07:00
parent 46f6706dda
commit dd597102a4
+1 -1
View File
@@ -1393,7 +1393,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
function createFlowMutation(flags: FlowFlags.Assignment | FlowFlags.ArrayMutation, antecedent: FlowNode, node: Expression | VariableDeclaration | ArrayBindingElement) {
setFlowNodeReferenced(antecedent);
hasFlowEffects = true;
hasFlowMutation = true;
if (node.kind !== SyntaxKind.VariableDeclaration && node.kind !== SyntaxKind.BindingElement) hasFlowMutation = true;
const result = createFlowNode(flags, node, antecedent) as FlowAssignment | FlowArrayMutation;
if (currentExceptionTarget) {
addAntecedent(currentExceptionTarget, result);