Skip to content

Commit 1482ade

Browse files
committed
Merge pull request microsoft#4919 from Microsoft/removeUnusedCode
[cleanup] removed duplicate function implementation
2 parents 7b48a18 + 2f75562 commit 1482ade

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/compiler/scanner.ts

+7-19
Original file line numberDiff line numberDiff line change
@@ -739,18 +739,6 @@ namespace ts {
739739
}
740740
}
741741

742-
function isIdentifierStart(ch: number): boolean {
743-
return ch >= CharacterCodes.A && ch <= CharacterCodes.Z || ch >= CharacterCodes.a && ch <= CharacterCodes.z ||
744-
ch === CharacterCodes.$ || ch === CharacterCodes._ ||
745-
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierStart(ch, languageVersion);
746-
}
747-
748-
function isIdentifierPart(ch: number): boolean {
749-
return ch >= CharacterCodes.A && ch <= CharacterCodes.Z || ch >= CharacterCodes.a && ch <= CharacterCodes.z ||
750-
ch >= CharacterCodes._0 && ch <= CharacterCodes._9 || ch === CharacterCodes.$ || ch === CharacterCodes._ ||
751-
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
752-
}
753-
754742
function scanNumber(): number {
755743
let start = pos;
756744
while (isDigit(text.charCodeAt(pos))) pos++;
@@ -1064,12 +1052,12 @@ namespace ts {
10641052
let start = pos;
10651053
while (pos < end) {
10661054
let ch = text.charCodeAt(pos);
1067-
if (isIdentifierPart(ch)) {
1055+
if (isIdentifierPart(ch, languageVersion)) {
10681056
pos++;
10691057
}
10701058
else if (ch === CharacterCodes.backslash) {
10711059
ch = peekUnicodeEscape();
1072-
if (!(ch >= 0 && isIdentifierPart(ch))) {
1060+
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
10731061
break;
10741062
}
10751063
result += text.substring(start, pos);
@@ -1439,17 +1427,17 @@ namespace ts {
14391427
return pos++, token = SyntaxKind.AtToken;
14401428
case CharacterCodes.backslash:
14411429
let cookedChar = peekUnicodeEscape();
1442-
if (cookedChar >= 0 && isIdentifierStart(cookedChar)) {
1430+
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
14431431
pos += 6;
14441432
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
14451433
return token = getIdentifierToken();
14461434
}
14471435
error(Diagnostics.Invalid_character);
14481436
return pos++, token = SyntaxKind.Unknown;
14491437
default:
1450-
if (isIdentifierStart(ch)) {
1438+
if (isIdentifierStart(ch, languageVersion)) {
14511439
pos++;
1452-
while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos))) pos++;
1440+
while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++;
14531441
tokenValue = text.substring(tokenPos, pos);
14541442
if (ch === CharacterCodes.backslash) {
14551443
tokenValue += scanIdentifierParts();
@@ -1536,7 +1524,7 @@ namespace ts {
15361524
p++;
15371525
}
15381526

1539-
while (p < end && isIdentifierPart(text.charCodeAt(p))) {
1527+
while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
15401528
p++;
15411529
}
15421530
pos = p;
@@ -1599,7 +1587,7 @@ namespace ts {
15991587
let firstCharPosition = pos;
16001588
while (pos < end) {
16011589
let ch = text.charCodeAt(pos);
1602-
if (ch === CharacterCodes.minus || ((firstCharPosition === pos) ? isIdentifierStart(ch) : isIdentifierPart(ch))) {
1590+
if (ch === CharacterCodes.minus || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
16031591
pos++;
16041592
}
16051593
else {

0 commit comments

Comments
 (0)