mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-11 02:03:59 +08:00
A Symbol.asyncIterator method that returns a compiled generator is iterated instead of refused. Async yield* awaits a synchronous delegate's final value, and return() results that are not objects throw V8's TypeError, which names primitive results. The coverage fixture drops its async yield* example, which now compiles.
25 lines
635 B
TypeScript
25 lines
635 B
TypeScript
// A program whose ENTRY PATH is fully static while an unused corner is
|
|
// not: builds succeed (unreached bodies never lower), and the report
|
|
// shows the corner's blockers in the dim "in unreached code" group.
|
|
function used(n: number): number {
|
|
return n + 1;
|
|
}
|
|
|
|
class Bag {
|
|
size = 0;
|
|
}
|
|
|
|
// Never called: the class-instance for-in and the labeled jump into a
|
|
// desugared loop can't fail a build.
|
|
function unusedCorner(bag: Bag, pairs: Map<string, number>): void {
|
|
for (const k in bag) {
|
|
console.log(k);
|
|
}
|
|
outer: for (const [k, v] of pairs) {
|
|
if (v > 0) break outer;
|
|
console.log(k);
|
|
}
|
|
}
|
|
|
|
console.log(used(41));
|