Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix microsoft#11480, disallow delete operator on readonly property or…
Browse files Browse the repository at this point in the history
… index

signature
HerringtonDarkholme committed Nov 2, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent d357207 commit c3a1152
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
@@ -13486,6 +13486,9 @@ namespace ts {

function checkDeleteExpression(node: DeleteExpression): Type {
checkExpression(node.expression);
checkReferenceExpression(node.expression,
Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference,
Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
return booleanType;
}

8 changes: 8 additions & 0 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
@@ -1971,6 +1971,14 @@
"category": "Error",
"code": 2697
},
"The operand of a delete operator must be a property reference": {
"category": "Error",
"code": 2698
},
"The operand of a delete operator cannot be a read-only property": {
"category": "Error",
"code": 2699
},

"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",

0 comments on commit c3a1152

Please sign in to comment.