mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- T[K] resolves against record bindings, Object.hasOwn/assign lower over records and the DOM, fixed shapes take runtime-keyed writes with the miss trap, and string|RegExp unions narrow by instanceof - the width family gains the checked NARROW lift and the tuple-arm literal route (the option-table shapes) - island literals complete: get accessors, plain spreads, tagged templates with .raw, jsval ??, and call-time fence deferral for unlowerable members (lambda poisons defer too) - JS variadic rests under --dynamic bind the engine arguments array and re-invoke through apply; dyn values marshal into the island as the deep copy - corpus 2470-2476 pin every landing against the Node oracle on both backends
21 lines
632 B
JavaScript
21 lines
632 B
JavaScript
// @dynamic
|
|
// The wrapper-rebuild idiom: a JS variadic arrow returned as a VALUE (the
|
|
// rest binding is the engine's own arguments array), an argument slot
|
|
// rewritten with a spread-built island literal, and the wrapped function
|
|
// re-invoked through the engine's apply.
|
|
/**
|
|
* @param {*} fn
|
|
* @returns {*}
|
|
*/
|
|
function withExtras(fn) {
|
|
return (...args) => {
|
|
args[1] = { ...(args[1] ?? {}), extra: true };
|
|
return fn(...args);
|
|
};
|
|
}
|
|
|
|
const wrapped = withExtras((text, options) => `${text}:${JSON.stringify(options)}`);
|
|
console.log(`${wrapped("hi", { a: 1 })}`);
|
|
console.log(`${wrapped("solo")}`);
|
|
console.log("done");
|