Files
scriptc/tests/corpus/callable-module-members.mjs
Chris Tate a36b356a6c Support native callable properties and terminal streams
- Preserve callable properties, descriptors, and shared module bindings across native JavaScript code.
- Add stored process streams with input control, output callbacks, and write interception.
- Preserve Error identity and classification through native rethrows and promise rejection.
2026-09-29 00:52:01 -05:00

20 lines
713 B
JavaScript

function unavailable(value) { throw value; }
function loadBackend(enabled) {
if (enabled) return { open(path, symbols) { return symbols; } };
return { open() { return unavailable(new Error('native backend')); } };
}
var backend = loadBackend(false);
var open = backend.open;
var other = backend['open'];
function getLibrary(value) { return open(value, { symbol: 'entry' }); }
class Library {
load(value) { return other(value, { symbol: 'entry' }); }
}
try { getLibrary('library'); }
catch (error) { console.log(error.message); }
try { new Library().load('library'); }
catch (error) { console.log(error.message); }
backend = loadBackend(true);
open = backend.open;
console.log(getLibrary('library').symbol);