mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-20 05:40:17 +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.
19 lines
495 B
JavaScript
19 lines
495 B
JavaScript
let evaluated = 0;
|
|
function scalar() {
|
|
evaluated++;
|
|
return "u32";
|
|
}
|
|
function defineStruct(fields) {
|
|
for (const [name, type, options = {}] of fields) {
|
|
console.log(name, Array.isArray(type) ? type.join(",") : type, options.lengthOf);
|
|
}
|
|
}
|
|
defineStruct([
|
|
["startCols", ["u32"]],
|
|
["startColsLen", "u32", { lengthOf: "startCols" }],
|
|
["widthCols", ["u32"]],
|
|
["widthColsLen", "u32", { lengthOf: "widthCols" }],
|
|
["widthColsMax", scalar()],
|
|
]);
|
|
console.log("evaluated", evaluated);
|