Add a quicker check for identifiers, check for space sooner.

This commit is contained in:
Daniel Rosenwasser 2024-07-11 21:49:29 +00:00
Родитель 18df637617
Коммит bc21cdd7bc
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -1883,6 +1883,11 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean
const ch = codePointUnchecked(pos);
if (CharacterCodes.a <= (ch | 32) && (ch | 32) <= CharacterCodes.z) {
const identifierKind = scanIdentifier(ch, languageVersion);
return identifierKind!;
}
switch (ch) {
case CharacterCodes.lineFeed:
case CharacterCodes.carriageReturn:
@ -1901,10 +1906,10 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean
}
return token = SyntaxKind.NewLineTrivia;
}
case CharacterCodes.space:
case CharacterCodes.tab:
case CharacterCodes.verticalTab:
case CharacterCodes.formFeed:
case CharacterCodes.space:
case CharacterCodes.nonBreakingSpace:
case CharacterCodes.ogham:
case CharacterCodes.enQuad: