mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
- Lower discarded conditionals as lazy statement control flow. - Add differential and TS7 coverage for void conditional arrows. Fixes #33 Co-authored-by: ryoppippi <1560508+ryoppippi@users.noreply.github.com>
23 lines
557 B
TypeScript
23 lines
557 B
TypeScript
let calls = 0;
|
|
|
|
function mark(label: string): void {
|
|
calls++;
|
|
console.log(label);
|
|
}
|
|
|
|
const choose = (first: boolean, second: boolean): void =>
|
|
first ? mark("first") : second ? mark("second") : mark("third");
|
|
|
|
choose(true, false);
|
|
choose(false, true);
|
|
choose(false, false);
|
|
|
|
function chooseStatement(first: boolean, second: boolean): void {
|
|
first ? mark("statement-first") : second ? mark("statement-second") : mark("statement-third");
|
|
}
|
|
|
|
chooseStatement(true, false);
|
|
chooseStatement(false, true);
|
|
chooseStatement(false, false);
|
|
console.log(calls);
|