Fix: False Positive "Range out of order in character class" in Regular Expressions in Unicode Modes (#58982)

This commit is contained in:
graphemecluster
2024-07-17 15:29:23 -04:00
committed by GitHub
parent 369f2b0fb8
commit e13ff2f26f
6 changed files with 203 additions and 2 deletions
+2 -2
View File
@@ -1640,7 +1640,7 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean
const nextStart = pos;
let nextPos = pos + 2;
for (; nextPos < nextStart + 6; nextPos++) {
if (!isHexDigit(charCodeUnchecked(pos))) {
if (!isHexDigit(charCodeUnchecked(nextPos))) {
// leave the error to the next call
return escapedValueString;
}
@@ -3552,7 +3552,7 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean
}
function scanSourceCharacter(): string {
const size = anyUnicodeMode ? charSize(charCodeChecked(pos)) : 1;
const size = anyUnicodeMode ? charSize(codePointChecked(pos)) : 1;
pos += size;
return size > 0 ? text.substring(pos - size, pos) : "";
}