Include 'delete' operator in control flow analysis

This commit is contained in:
Anders Hejlsberg
2016-05-11 16:57:06 -07:00
parent cd11d3dc91
commit 65468ed352
2 changed files with 12 additions and 0 deletions

View File

@@ -580,6 +580,9 @@ namespace ts {
case SyntaxKind.BinaryExpression:
bindBinaryExpressionFlow(<BinaryExpression>node);
break;
case SyntaxKind.DeleteExpression:
bindDeleteExpressionFlow(<DeleteExpression>node);
break;
case SyntaxKind.ConditionalExpression:
bindConditionalExpressionFlow(<ConditionalExpression>node);
break;
@@ -1055,6 +1058,13 @@ namespace ts {
}
}
function bindDeleteExpressionFlow(node: DeleteExpression) {
forEachChild(node, bind);
if (node.expression.kind === SyntaxKind.PropertyAccessExpression) {
bindAssignmentTargetFlow(node.expression);
}
}
function bindConditionalExpressionFlow(node: ConditionalExpression) {
const trueLabel = createBranchLabel();
const falseLabel = createBranchLabel();

View File

@@ -7563,6 +7563,8 @@ namespace ts {
return checkRightHandSideOfForOf((<ForOfStatement>parent).expression) || unknownType;
case SyntaxKind.BinaryExpression:
return getAssignedTypeOfBinaryExpression(<BinaryExpression>parent);
case SyntaxKind.DeleteExpression:
return undefinedType;
case SyntaxKind.ArrayLiteralExpression:
return getAssignedTypeOfArrayLiteralElement(<ArrayLiteralExpression>parent, node);
case SyntaxKind.SpreadElementExpression: