fix scope assignment to switch expressions (#5826)

fixes #5787
fixes #5792
This commit is contained in:
Alex Lam S.L
2024-06-05 22:05:16 +03:00
committed by GitHub
parent ffe0fe7762
commit 34b6143306
4 changed files with 115 additions and 0 deletions

View File

@@ -178,6 +178,13 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
});
return true;
}
if (node instanceof AST_Switch) {
node.expression.walk(tw);
walk_scope(function() {
walk_body(node, tw);
});
return true;
}
if (node instanceof AST_SwitchBranch) {
node.init_vars(scope);
descend();