mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Add specific error messages for out-of-place this
Also remove lint in checker.
This commit is contained in:
@@ -11624,8 +11624,11 @@ namespace ts {
|
||||
error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
||||
}
|
||||
if ((<Identifier>node.name).text === "this") {
|
||||
if(indexOf(func.parameters, node) !== 0 || func.kind === SyntaxKind.Constructor) {
|
||||
error(node, Diagnostics.this_cannot_be_referenced_in_current_location);
|
||||
if (indexOf(func.parameters, node) !== 0) {
|
||||
error(node, Diagnostics.this_parameter_must_be_the_first_parameter);
|
||||
}
|
||||
if (func.kind === SyntaxKind.Constructor) {
|
||||
error(node, Diagnostics.A_constructor_cannot_have_a_this_parameter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1827,6 +1827,14 @@
|
||||
"category": "Error",
|
||||
"code": 2672
|
||||
},
|
||||
"'this' parameter must be the first parameter.": {
|
||||
"category": "Error",
|
||||
"code": 2673
|
||||
},
|
||||
"A constructor cannot have a 'this' parameter.": {
|
||||
"category": "Error",
|
||||
"code": 2674
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
|
||||
Reference in New Issue
Block a user