mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- Preserve async factory results and mixed table layouts through inference and destructuring. - Support checked Map and Object.fromEntries construction with native weak collections. - Keep native weak-key lifetimes and engine-backed collection identities intact.
27 lines
727 B
TypeScript
27 lines
727 B
TypeScript
class Pair {
|
|
a = 1;
|
|
b = 2;
|
|
}
|
|
|
|
function earlierGenericSource<T>(_: T): void {
|
|
const value = { b: 2, a: 1 };
|
|
console.log(Object.keys(value).length);
|
|
}
|
|
|
|
function earlierOrdinary(): void {
|
|
earlierGenericSource(1);
|
|
}
|
|
|
|
function laterGeneric<T>(_: T): void {
|
|
const sameShape = { a: 1, b: 2 };
|
|
console.log(Object.keys(sameShape).length);
|
|
earlierOrdinary();
|
|
// The deferred rest-order rejection must poison this whole statement:
|
|
// the later WeakRef declarator is never visited, and the next statement
|
|
// sees rest as a blocked binding just like the historical emit pass.
|
|
const { ...rest } = new Pair(), blocked = new WeakRef<object>({});
|
|
console.log(Object.keys(rest).join(","), blocked);
|
|
}
|
|
|
|
laterGeneric(1);
|