mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-24 06:14:01 +08:00
* Compile Effect generators statically * test: declare the dormant array write's expected fence
24 lines
696 B
JavaScript
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"));
|
|
}
|