Skip to content

Commit

Permalink
fix microsoft#11480, disallow delete operator on readonly property or…
Browse files Browse the repository at this point in the history
… index

signature
  • Loading branch information
HerringtonDarkholme committed Nov 3, 2016
1 parent ab75ea7 commit 2e8bbf0
Show file tree
Hide file tree
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
Expand Up @@ -13550,6 +13550,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;
}

Expand Down
8 changes: 8 additions & 0 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,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",
Expand Down

0 comments on commit 2e8bbf0

Please sign in to comment.