Files
scriptc/tests/fixtures/npm/node_modules/plugstub/index.js
T
Chris Tate b98d726382 for-of, destructuring, and spread over island values held in 'unknown' drain the engine's own iterator; engine arrays exit into 'any[]' slots
- The iteration pack's JSVAL arm is ARMED (scr_dyn_iter_pack, scr_dyn_arr_push_spread, scr_dyn_pack_push_spread_iter route through the new iter_drain ops row): the ENGINE's iterator protocol drains into a fresh DOM array — engine arrays, generators, Maps, Sets, and Symbol.iterator implementations step exactly as Node runs them, elements wrapping back scalar-normalized.
- for-of over checked-dynamic values LOWERS now (both backends): the source packs once through dyn.iterPack and a hidden index loop binds each element as a dyn value (new dyn.arrLen/dyn.arrAt accessors) — an eager snapshot, the matchAll stance. Pattern heads, pre-declared and var heads, and labeled break/continue all ride the desugar. Non-iterables throw V8's for-of CallPrinter spellings, threaded into the engine-side guard.
- The validated exit gains the jsval-element-array arm (scr_jsval_exit_jsval_arr, both backends): an 'any' value exits into 'any[]'- and 'any[] | undefined'-declared slots Array.isArray-gated, elements BY REFERENCE (identity crosses, the spine is a snapshot) — the withPlugins loadPlugins(plugins) boundary, the driver frontier's first named poison.
- Corpus 2604 and npm case jsval-iterate (package-minted Set/Map/generator/Symbol.iterator) are byte-identical to Node under both backends; dyncheck's jsval-iterate pin flips from the retired island fence to the armed answers; SAN clean over the drain/wrap/exit churn.
2026-07-24 11:04:10 -05:00

26 lines
1.2 KiB
JavaScript

// The prettier-plugins stand-in from the world-unification design's
// appendix A: an array of plugin records whose members carry engine
// functions, exported as `any` (index.d.ts) so consumers hold ISLAND
// values under --dynamic.
export const plugins = [
{
languages: [{ name: "js", parsers: ["babel"] }],
options: { semi: { category: "js", type: "boolean", default: true } },
parsers: { babel: { parse: (t) => ({ type: "root", src: t }) } },
},
];
export const obj = { a: 1 };
export const scalars = { n: 5, s: "hi", b: true, nul: null, und: undefined };
// Engine-minted iterables (lane dom-jsval-long-tail): the PACKAGE owns
// these, so a wrapped consumer iterates the engine's own protocols —
// generator, Set, Map, and a plain array. mintGen answers a FRESH
// generator per call (one-shot protocol, engine-exact).
export const iterables = {
list: [10, 20, 30],
set: new Set(["s1", "s2"]),
map: new Map([["k", "v"], ["k2", "v2"]]),
mintGen: () => (function* () { yield 1; yield 2; })(),
custom: { [Symbol.iterator]() { let i = 0; return { next: () => (i < 2 ? { value: "c" + i++, done: false } : { value: undefined, done: true }) } } },
notIterable: { a: 1 },
};