mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00: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:
1 parent
31fca3af4d
commit
a211184347
13 files changed
+241
-50
No files matched your search
@@ -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