fix(compiler): translate 5 SpeckDL expression patterns to JavaScript

- notIn -> !map.has(key): 't.id notIn transfers.keys' -> '!transfers.has(t.id)'
- old(expr) -> drop wrapper: specification construct, no JS equivalent
- union -> Set spread: 'pending union {t.id}' -> 'new Set([...pending, t.id])'
- \ -> Set difference via filter: 'pending \ {id}' -> 'new Set([...pending].filter(x => x !== id))'
- Trailing == at end-of-string -> ===, then clean up empty RHS comparisons

All 41 tests passing. TigerBeetle: 0 notIn, 0 old(, 0 union, 0 \, 0 ==)
This commit is contained in:
Scott Scoble 2026-05-09 16:08:46 -07:00
parent 9de0a5ca0f
commit e92f430fb3
5 changed files with 80 additions and 7 deletions

View file

@ -133,6 +133,12 @@ export type ActionStatement = {
} | {
type: 'require';
expr: string;
} | {
type: 'precondition';
expr: string;
} | {
type: 'postcondition';
expr: string;
} | {
type: 'emit';
event: string;