mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* perf: skip island type probes in static compilation * test: retain reached declaration checker panic diagnostics * test: make child backpressure event ordering deterministic * perf: index JavaScript binding writes once per scope * test: record preflight baseline for binding writes fixture
25 lines
605 B
JavaScript
25 lines
605 B
JavaScript
let shared = 0;
|
|
function setShared(value) { shared = value; }
|
|
setShared("global");
|
|
console.log("shared", typeof shared, shared);
|
|
|
|
function scoped(value) {
|
|
let state = 0;
|
|
const update = (next) => { state = next; };
|
|
update(value);
|
|
{
|
|
let state = 0;
|
|
const update = (next) => { state = next; };
|
|
update("inner");
|
|
console.log("shadow", typeof state, state);
|
|
}
|
|
console.log("scope", typeof state, state);
|
|
}
|
|
scoped("outer");
|
|
scoped(true);
|
|
|
|
/** @type {number} */ let annotated = 1;
|
|
function updateNumber(value) { annotated = value; }
|
|
updateNumber(4);
|
|
console.log("annotated", annotated);
|