Preserve record order in retained lowering

This commit is contained in:
Chris Tate
2026-08-20 09:18:22 -05:00
parent bc973cf653
commit 4264aca03f
4 changed files with 182 additions and 56 deletions
@@ -0,0 +1,11 @@
// Retained reachability lowers module inits before the function bodies they
// discover. Record metadata must still use the historical emit order: this
// function's {a,b} shape precedes the init's structurally-equal {b,a} shape.
function printFunctionRecord(): void {
const value = { a: 1, b: 2 };
console.log(Object.keys(value).join(","));
console.log(JSON.stringify(value));
}
printFunctionRecord();
console.log(Object.keys({ b: 2, a: 1 }).length);