mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Clarified error message; extended error to identifier end
Lengthening the reported error length to include all of the identifier necessitates scanning for all of the identifier. I also reset the `pos` after so other identifier scanning still happens.
This commit is contained in:
@@ -1011,7 +1011,7 @@
|
||||
"category": "Message",
|
||||
"code": 1350
|
||||
},
|
||||
"An identifier cannot follow a numeric literal.": {
|
||||
"An identifier or keyword cannot immediately follow a numeric literal.": {
|
||||
"category": "Error",
|
||||
"code": 1351
|
||||
},
|
||||
|
||||
@@ -991,9 +991,14 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkForIdentifierStartAfterNumericLiteral() {
|
||||
if (isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
|
||||
error(Diagnostics.An_identifier_cannot_follow_a_numeric_literal, pos, 1);
|
||||
if (!isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const identifierStart = pos;
|
||||
const { length } = scanIdentifierParts();
|
||||
error(Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length);
|
||||
pos = identifierStart;
|
||||
}
|
||||
|
||||
function scanOctalDigits(): number {
|
||||
|
||||
Reference in New Issue
Block a user