Files
scriptc/tests/corpus/3082-forward-write-unwind.ts
Chris Tate 8e95bcbe7f feat(compiler): advance native validator self-hosting (#492)
- Support mutable forward captures with correct initialization and exception behavior.
- Compile recursive literals, exhaustive bindings, and validator collection operations statically.
- Run validator control-flow analysis natively with C and LLVM differential coverage.
2026-09-27 12:14:06 -05:00

31 lines
1.1 KiB
TypeScript

export {};
// No explicit throw in this program: the may-throw graph must discover the
// TDZ store itself and propagate it through direct and closure calls.
function writes(): void {
function set(): void { value = 9; }
try { set(); console.log("unreachable direct"); }
catch (error) { if (error instanceof Error) console.log("direct", error.name, error.message); }
const assign = () => value = 4;
try { assign(); console.log("unreachable indirect"); }
catch (error) { if (error instanceof Error) console.log("indirect", error.name, error.message); }
let value = 1;
set();
console.log("after", assign(), value);
}
writes();
function increments(): void {
function up(): void { count++; }
function down(): void { --count; }
try { up(); console.log("unreachable increment"); }
catch (error) { if (error instanceof Error) console.log("increment", error.name, error.message); }
try { down(); console.log("unreachable decrement"); }
catch (error) { if (error instanceof Error) console.log("decrement", error.name, error.message); }
let count = 3;
up();
down();
console.log("count", count);
}
increments();