Files
scriptc/tests/corpus/module-fallback-functions/platform.js
Chris Tate 7d5a471c67 Compile renderer values and callbacks natively
- Preserve unbound class methods, call-time receivers, and bound callback arguments.
- Keep native factory results, fallback functions, and mutable JavaScript renderer state intact.
- Support live Error.cause assignment, deletion, and property descriptors across aliases.
2026-09-28 13:54:28 -05:00

14 lines
659 B
JavaScript

const runtime = globalThis[Symbol.for("scriptc.test.runtime")];
beforeInitialization();
export var sleep = runtime?.sleep ?? standardSleep;
export var format = runtime?.format || standardFormat;
export var selected = runtime ? standardFormat : alternateFormat;
function beforeInitialization() {
console.log(typeof sleep);
try { sleep(0); } catch (error) { console.log(error.name); }
}
function standardSleep(value) { return Promise.resolve(value); }
function standardFormat(value) { return `standard:${value}`; }
function alternateFormat(value) { return `alternate:${value}`; }
export function replace() { sleep = (value) => Promise.resolve(value + 1); }