Files
scriptc/tests/corpus/js-shared-method-dispatch.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

15 lines
485 B
JavaScript

class Widget {
work(value) { return this.base + value; }
constructor() { this.base = 10; }
}
const first = new Widget(), second = new Widget();
function replace() {
first.work = function (value) { return this.base * value; };
return 2;
}
console.log(first.work(replace()), first.work(3), second.work(4));
first.work = 1;
second.work = 2;
try { first.work(0); } catch (error) { console.log(error.message); }
try { second.work(0); } catch (error) { console.log(error.message); }