This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Description
In the JavaScript stack graphs, name resolution inside a switch statement breaks when multiple case labels precede a single consequent. The scope/flow modeling appears to keep the first branch “open” across subsequent cases, causing references in later cases to lose access to outer-scope bindings. Splitting the cases so that each label has its own block makes the problem disappear.
Failing example (multiple case labels share one branch)
function print(string) {
console.log(string);
}
switch (type) {
case "Int8Array":
case "BigUint64Array": {
console.log("Int Array");
}
case "ArrayBuffer": {
print(base64); // not resolving
}
}
Observed result from navigation/definitions:
| print(base64);
| ^^^^
has no definitions
Passing example (each case has its own block)
function print(string) {
console.log(string);
}
switch (type) {
case "Int8Array": {
console.log("something");
}
case "ArrayBuffer": {
print(base64); // resolves successfully
}
}
Expected behavior
print in the case "ArrayBuffer" branch should resolve to the function declared above, regardless of how many case labels precede other branches.
Actual behavior
When multiple case labels share a single consequent earlier in the switch, subsequent branches report references as unresolved (“has no definitions”).