Move grammar check: deleteExpression
This commit is contained in:
parent
00449d80a3
commit
90e1d4244f
2 changed files with 8 additions and 1 deletions
|
@ -6555,6 +6555,13 @@ module ts {
|
|||
}
|
||||
|
||||
function checkDeleteExpression(node: DeleteExpression): Type {
|
||||
// Grammar checking
|
||||
if (node.parserContextFlags & ParserContextFlags.StrictMode && node.expression.kind === SyntaxKind.Identifier) {
|
||||
// When a delete operator occurs within strict mode code, a SyntaxError is thrown if its
|
||||
// UnaryExpression is a direct reference to a variable, function argument, or function name
|
||||
grammarErrorOnNode(node.expression, Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode);
|
||||
}
|
||||
|
||||
var operandType = checkExpression(node.expression);
|
||||
return booleanType;
|
||||
}
|
||||
|
|
|
@ -4640,7 +4640,7 @@ module ts {
|
|||
//case SyntaxKind.ClassDeclaration: return checkClassDeclaration(<ClassDeclaration>node);
|
||||
//case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(<ComputedPropertyName>node);
|
||||
case SyntaxKind.Constructor: return checkConstructor(<ConstructorDeclaration>node);
|
||||
case SyntaxKind.DeleteExpression: return checkDeleteExpression(<DeleteExpression> node);
|
||||
//case SyntaxKind.DeleteExpression: return checkDeleteExpression(<DeleteExpression> node);
|
||||
case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(<ElementAccessExpression>node);
|
||||
case SyntaxKind.ExportAssignment: return checkExportAssignment(<ExportAssignment>node);
|
||||
case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(<ExternalModuleReference>node);
|
||||
|
|
Loading…
Reference in a new issue