Skip to content

Commit 51d10ee

Browse files
author
Josh Goldberg
committed
Removed excess new check
1 parent 174816f commit 51d10ee

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/compiler/scanner.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,8 @@ namespace ts {
975975
result = text.substring(start, end); // No need to use all the fragments; no _ removal needed
976976
}
977977

978-
checkForIdentifierAfterNumericLiteral();
979978
if (decimalFragment !== undefined || tokenFlags & TokenFlags.Scientific) {
980-
checkForIdentifierAfterNumericLiteral();
979+
checkForIdentifierStartAfterNumericLiteral();
981980
return {
982981
type: SyntaxKind.NumericLiteral,
983982
value: "" + +result // if value is not an integer, it can be safely coerced to a number
@@ -986,12 +985,12 @@ namespace ts {
986985
else {
987986
tokenValue = result;
988987
const type = checkBigIntSuffix(); // if value is an integer, check whether it is a bigint
989-
checkForIdentifierAfterNumericLiteral();
988+
checkForIdentifierStartAfterNumericLiteral();
990989
return { type, value: tokenValue };
991990
}
992991
}
993992

994-
function checkForIdentifierAfterNumericLiteral() {
993+
function checkForIdentifierStartAfterNumericLiteral() {
995994
if (isIdentifierStart(text.charCodeAt(pos), languageVersion)) {
996995
error(Diagnostics.An_identifier_cannot_follow_a_numeric_literal, pos, 1);
997996
}

0 commit comments

Comments
 (0)