mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* Expand static Effect support across common APIs * Preserve compiler parity across expanded Effect patterns * Fix compiler regressions exposed by Effect coverage * Bound shared type conversion traversal * Clarify conversion contracts and tidy fixtures * Run every Effect fixture in CI shards * Preserve inferred array assignments in concurrent Effect programs * Record inferred array fixture compiler ordering
21 lines
824 B
JavaScript
21 lines
824 B
JavaScript
const events = [];
|
|
function argument() { events.push("arg"); return 2; }
|
|
function receiver(value) { events.push("receiver"); return value; }
|
|
const present = {
|
|
base: 40,
|
|
get callback() {
|
|
events.push("get");
|
|
return function(value) { events.push("call"); return this.base + value; };
|
|
}
|
|
};
|
|
function invoke(value) { return receiver(value).callback?.(argument()); }
|
|
console.log(invoke(present), events.join(","));
|
|
events.length = 0;
|
|
console.log(invoke({ callback: null }), events.join(","));
|
|
events.length = 0;
|
|
function key() { events.push("key"); return "callback"; }
|
|
function computed(value) { return receiver(value)[key()]?.(argument()); }
|
|
console.log(computed(present), events.join(","));
|
|
function optional(callback) { return callback?.(...[2, 3]); }
|
|
console.log(optional((a, b) => a + b), optional(undefined));
|