Skip to content

Commit

Permalink
fix panic on switch case function
Browse files Browse the repository at this point in the history
  • Loading branch information
dloebl committed Mar 3, 2025
1 parent 94a2f61 commit 83a6041
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/js_parser/js_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -10967,6 +10967,7 @@ func (p *parser) visitAndAppendStmt(stmts []js_ast.Stmt, stmt js_ast.Stmt) []js_
c := &s.Cases[i]
if c.ValueOrNil.Data != nil {
c.ValueOrNil = p.visitExpr(c.ValueOrNil)
c.Body = p.visitStmts(c.Body, stmtsSwitch)
p.warnAboutEqualityCheck("case", c.ValueOrNil, c.ValueOrNil.Loc)
p.warnAboutTypeofAndString(s.Test, c.ValueOrNil, onlyCheckOriginalOrder)
}
Expand All @@ -10993,7 +10994,6 @@ func (p *parser) visitAndAppendStmt(stmts []js_ast.Stmt, stmt js_ast.Stmt) []js_
if isAlwaysDead {
p.isControlFlowDead = true
}
c.Body = p.visitStmts(c.Body, stmtsSwitch)
p.isControlFlowDead = old

// Filter out this case when minifying if it's known to be dead. Visiting
Expand Down

0 comments on commit 83a6041

Please sign in to comment.