Fix SQLitePager, improve and/or rewrite, add emptySet
- SQLitePager: 4 errors → 0 errors - Added emptySet → new Set() rewrite - Fix and/or regex to avoid matching method calls like .or() - Progress: 12 specs at 0 errors
This commit is contained in:
parent
832feb47b3
commit
52be7b1c6d
1 changed files with 5 additions and 1 deletions
|
|
@ -488,7 +488,8 @@ function rewriteExpr(expr: string, stateVarNames: Set<string>, mapVarNames: Set<
|
|||
ts = ts.replace(/\bnot\s+/g, '!');
|
||||
|
||||
// 5d2: and -> &&, or -> || (logical operators)
|
||||
ts = ts.replace(/\band\b/g, '&&').replace(/\bor\b/g, '||');
|
||||
// Avoid matching inside method calls like .or( or .and(
|
||||
ts = ts.replace(/([^.]\s*)\band\b(?!\s*\()/g, '$1&&').replace(/([^.]\s*)\bor\b(?!\s*\()/g, '$1||');
|
||||
|
||||
// 5d3: Strip SpeckDL comments (// ...) before TS processing
|
||||
ts = ts.replace(/\/\/.*$/gm, '');
|
||||
|
|
@ -509,6 +510,9 @@ function rewriteExpr(expr: string, stateVarNames: Set<string>, mapVarNames: Set<
|
|||
return `new Map([[${k}, ${v}]])`;
|
||||
});
|
||||
|
||||
// 5d6: emptySet -> new Set()
|
||||
ts = ts.replace(/\bemptySet\b/g, 'new Set()');
|
||||
|
||||
// 5e: Clean up trailing empty comparisons (===) — expression has no RHS after old() removal
|
||||
// "accounts[t.from].debits_posted ===" -> "accounts[t.from].debits_posted === accounts[t.from].debits_posted"
|
||||
ts = ts.replace(/(\S+)\s*===\s*$/g, '$1 === $1');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue