Files
scriptc/tests/corpus/js-iterable-spread.js
Chris Tate a07998f667 Expand static three.js workflows and host integration (#621)
* Expand static three.js workflows and host integration

* Preserve JavaScript class state in static three.js workflows

* Preserve inferred JavaScript behavior across static workflows

* Preserve inferred callables and native compatibility boundaries

* Retain annotated JavaScript factory exports and bootstrap-safe call spreads

* Preserve Buffer and child callback identities in static packages

* Clarify JavaScript symbol spread support
2026-10-02 19:56:34 -05:00

17 lines
606 B
JavaScript

class Coordinates {
constructor(x, y) { this.x = x; this.y = y; }
*[Symbol.iterator]() { yield this.x; yield this.y; }
}
function collect(value) {
return ((...values) => values.join(","))(0, ...value, 3);
}
console.log(collect(new Coordinates(1, 2)));
console.log(collect([4, 5]));
console.log(collect("😀a"));
let steps = 0;
class Broken {
*[Symbol.iterator]() { steps++; yield 1; steps++; throw new Error("iteration"); }
}
try { collect(new Broken()); } catch (error) { console.log(error.message, steps); }
try { collect({ length: 2, 0: 1, 1: 2 }); } catch (error) { console.log(error.name); }