mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-02 08:35:07 +08:00
* Compile Effect generators statically * test: declare the dormant array write's expected fence
23 lines
844 B
TypeScript
23 lines
844 B
TypeScript
function inner(): Error { return new Error("boom"); }
|
|
function outer(): Error { return inner(); }
|
|
const error = outer();
|
|
const stack = error.stack!;
|
|
console.log(stack.split("\n")[0]);
|
|
console.log(stack.includes("at inner"), stack.includes("at outer"));
|
|
console.log(stack === error.stack);
|
|
error.message = "changed";
|
|
console.log(error.stack === stack);
|
|
function* generator() {
|
|
yield new Error("before");
|
|
yield new Error("after");
|
|
}
|
|
const iterator = generator();
|
|
const before = iterator.next().value as Error;
|
|
const after = iterator.next().value as Error;
|
|
console.log(before.stack!.includes("at generator"), after.stack!.includes("at generator"));
|
|
iterator.next();
|
|
function fail(): void { throw new Error("failure"); }
|
|
try { fail(); } catch {}
|
|
const later = inner().stack!;
|
|
console.log(later.includes("at inner"), later.includes("at fail"));
|