mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* Compile Effect generators statically * test: declare the dormant array write's expected fence
24 lines
541 B
JavaScript
24 lines
541 B
JavaScript
const key = Symbol.for("scriptc.inferred.symbol");
|
|
const variance = { identity: value => value, version: "one" };
|
|
|
|
class Holder {
|
|
[key];
|
|
constructor(value) {
|
|
console.log(this[key]);
|
|
this[key] = value;
|
|
}
|
|
read() { return this[key]; }
|
|
}
|
|
class Derived extends Holder {
|
|
[key];
|
|
}
|
|
class Initialized {
|
|
[key] = variance;
|
|
read(value) { return this[key].identity(value); }
|
|
}
|
|
|
|
const holder = new Holder("value");
|
|
console.log(holder.read());
|
|
console.log(new Derived("base").read());
|
|
console.log(new Initialized().read("inferred"));
|