Skip to content

Commit 65468ed

Browse files
committed
Include 'delete' operator in control flow analysis
1 parent cd11d3d commit 65468ed

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/compiler/binder.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,9 @@ namespace ts {
580580
case SyntaxKind.BinaryExpression:
581581
bindBinaryExpressionFlow(<BinaryExpression>node);
582582
break;
583+
case SyntaxKind.DeleteExpression:
584+
bindDeleteExpressionFlow(<DeleteExpression>node);
585+
break;
583586
case SyntaxKind.ConditionalExpression:
584587
bindConditionalExpressionFlow(<ConditionalExpression>node);
585588
break;
@@ -1055,6 +1058,13 @@ namespace ts {
10551058
}
10561059
}
10571060

1061+
function bindDeleteExpressionFlow(node: DeleteExpression) {
1062+
forEachChild(node, bind);
1063+
if (node.expression.kind === SyntaxKind.PropertyAccessExpression) {
1064+
bindAssignmentTargetFlow(node.expression);
1065+
}
1066+
}
1067+
10581068
function bindConditionalExpressionFlow(node: ConditionalExpression) {
10591069
const trueLabel = createBranchLabel();
10601070
const falseLabel = createBranchLabel();

src/compiler/checker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7563,6 +7563,8 @@ namespace ts {
75637563
return checkRightHandSideOfForOf((<ForOfStatement>parent).expression) || unknownType;
75647564
case SyntaxKind.BinaryExpression:
75657565
return getAssignedTypeOfBinaryExpression(<BinaryExpression>parent);
7566+
case SyntaxKind.DeleteExpression:
7567+
return undefinedType;
75667568
case SyntaxKind.ArrayLiteralExpression:
75677569
return getAssignedTypeOfArrayLiteralElement(<ArrayLiteralExpression>parent, node);
75687570
case SyntaxKind.SpreadElementExpression:

0 commit comments

Comments
 (0)