mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
removed duplicate function implementation
This commit is contained in:
parent
7b48a182c0
commit
2f7556256a
@ -739,18 +739,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isIdentifierStart(ch: number): boolean {
|
||||
return ch >= CharacterCodes.A && ch <= CharacterCodes.Z || ch >= CharacterCodes.a && ch <= CharacterCodes.z ||
|
||||
ch === CharacterCodes.$ || ch === CharacterCodes._ ||
|
||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierStart(ch, languageVersion);
|
||||
}
|
||||
|
||||
function isIdentifierPart(ch: number): boolean {
|
||||
return ch >= CharacterCodes.A && ch <= CharacterCodes.Z || ch >= CharacterCodes.a && ch <= CharacterCodes.z ||
|
||||
ch >= CharacterCodes._0 && ch <= CharacterCodes._9 || ch === CharacterCodes.$ || ch === CharacterCodes._ ||
|
||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
||||
}
|
||||
|
||||
function scanNumber(): number {
|
||||
let start = pos;
|
||||
while (isDigit(text.charCodeAt(pos))) pos++;
|
||||
@ -1064,12 +1052,12 @@ namespace ts {
|
||||
let start = pos;
|
||||
while (pos < end) {
|
||||
let ch = text.charCodeAt(pos);
|
||||
if (isIdentifierPart(ch)) {
|
||||
if (isIdentifierPart(ch, languageVersion)) {
|
||||
pos++;
|
||||
}
|
||||
else if (ch === CharacterCodes.backslash) {
|
||||
ch = peekUnicodeEscape();
|
||||
if (!(ch >= 0 && isIdentifierPart(ch))) {
|
||||
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
|
||||
break;
|
||||
}
|
||||
result += text.substring(start, pos);
|
||||
@ -1439,7 +1427,7 @@ namespace ts {
|
||||
return pos++, token = SyntaxKind.AtToken;
|
||||
case CharacterCodes.backslash:
|
||||
let cookedChar = peekUnicodeEscape();
|
||||
if (cookedChar >= 0 && isIdentifierStart(cookedChar)) {
|
||||
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
|
||||
pos += 6;
|
||||
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
|
||||
return token = getIdentifierToken();
|
||||
@ -1447,9 +1435,9 @@ namespace ts {
|
||||
error(Diagnostics.Invalid_character);
|
||||
return pos++, token = SyntaxKind.Unknown;
|
||||
default:
|
||||
if (isIdentifierStart(ch)) {
|
||||
if (isIdentifierStart(ch, languageVersion)) {
|
||||
pos++;
|
||||
while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos))) pos++;
|
||||
while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++;
|
||||
tokenValue = text.substring(tokenPos, pos);
|
||||
if (ch === CharacterCodes.backslash) {
|
||||
tokenValue += scanIdentifierParts();
|
||||
@ -1536,7 +1524,7 @@ namespace ts {
|
||||
p++;
|
||||
}
|
||||
|
||||
while (p < end && isIdentifierPart(text.charCodeAt(p))) {
|
||||
while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
|
||||
p++;
|
||||
}
|
||||
pos = p;
|
||||
@ -1599,7 +1587,7 @@ namespace ts {
|
||||
let firstCharPosition = pos;
|
||||
while (pos < end) {
|
||||
let ch = text.charCodeAt(pos);
|
||||
if (ch === CharacterCodes.minus || ((firstCharPosition === pos) ? isIdentifierStart(ch) : isIdentifierPart(ch))) {
|
||||
if (ch === CharacterCodes.minus || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
|
||||
pos++;
|
||||
}
|
||||
else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user