fix(debugger): identifier boundary check for astral letters under V8 (#1117)

Smart Step Into and Safe Delete tested the text before a match with /[\p{L}\p{N}_$]$/u, which V8 in Node 26 fails for a letter outside the BMP (a lone property class before $), so smartStep.test.ts failed. Both checks now use an alternation with the same meaning.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-04 07:57:12 +08:00
1 джерело a1dd16f26d
коміт b9f3c07f9b
2 files changed
+4 -2

No files matched your search

+2 -1
Переглянути файл
@@ -365,7 +365,8 @@ export function textOccurrences(
const out: { from: number; to: number }[] = [];
for (let m = re.exec(text); m; m = re.exec(text)) {
const from = m.index;
if (/[\p{L}\p{N}_$]$/u.test(text.slice(Math.max(0, from - 2), from))) continue;
// Not `[\p{L}\p{N}_$]$`: V8 (Node 26) misses an astral letter with a lone class before `$`.
if (/(?:\p{L}|\p{N}|[_$])$/u.test(text.slice(Math.max(0, from - 2), from))) continue;
if (ids.has(from) || (from >= exclude.from && from < exclude.to)) continue;
out.push({ from, to: from + name.length });
}
+2 -1
Переглянути файл
@@ -29,7 +29,8 @@ function callPattern(name: string, flags: string): RegExp {
}
function isCallBoundary(text: string, from: number): boolean {
return !/[\p{L}\p{N}_$]$/u.test(text.slice(Math.max(0, from - 2), from));
// Not `[\p{L}\p{N}_$]$`: V8 (Node 26) misses an astral letter with a lone class before `$`.
return !/(?:\p{L}|\p{N}|[_$])$/u.test(text.slice(Math.max(0, from - 2), from));
}
function identifierEnd(text: string, from: number): number {