Files
Chris Tate c257368c5e Compile Effect generators statically (#589)
* Compile Effect generators statically

* test: declare the dormant array write's expected fence
2026-09-30 14:25:29 -05:00

24 lines
696 B
JavaScript

class Base {
prefix = "base";
read(value) { return this.prefix + ":" + value; }
}
class Middle extends Base {}
class Leaf extends Middle {
own(value) { return this.read(value); }
}
const helpers = {
invoke(value, input) { return value.read(input); },
own(value, input) { return value.own(input); },
extract(value) { return value.read; }
};
export function run() {
const first = new Leaf();
const second = new Leaf();
second.prefix = "second";
console.log(helpers.invoke(first, "inherited"));
console.log(helpers.own(first, "own"));
const method = helpers.extract(first);
console.log(method === helpers.extract(second));
console.log(method.call(second, "detached"));
}