Files
scriptc/tests/corpus/js-object-receiver-storage.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

29 lines
917 B
JavaScript

function registry() {
const object = {
entries: {},
add(values) { Object.assign(this.entries, values); },
get(key) { return object.entries[key]; },
};
object.add({ first: 3 });
return object;
}
const object = registry();
object.add({ second: 7 });
console.log(object.get("first"), object.get("second"), object.get("missing"));
class NumericField {
constructor() { this.value = 1; }
read(array, index) { this.value = array[index]; return this; }
add(number) { this.value += number; return this.value; }
}
const numeric = new NumericField().read([2], 1);
console.log(numeric.value, Number.isNaN(numeric.add(3)));
/** @returns {number|null} */
function documented(flag) { if (flag) return 5; }
console.log(documented(true), documented(false));
function findLast(flags) {
let found;
for (const flag of flags) found = documented(flag);
return found;
}
console.log(findLast([true, false]));