Skip to content

Commit

Permalink
Fix debugging of switch statements (fix #2562)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Oct 10, 2024
1 parent e770407 commit 7105ca3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/jsparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,7 @@ NO_INLINE JsVar *jspeStatementSwitch() {
JSP_ASSERT_MATCH(LEX_R_SWITCH);
JSP_MATCH('(');
JsVar *switchOn = jspeExpression();
JsExecFlags preservedExecState = execInfo.execute&EXEC_IN_LOOP;
JsExecFlags preservedExecState = execInfo.execute&(EXEC_IN_LOOP|EXEC_DEBUGGER_MASK);
JSP_SAVE_EXECUTE();
bool execute = JSP_SHOULD_EXECUTE;
JSP_MATCH_WITH_CLEANUP_AND_RETURN(')', jsvUnLock(switchOn), 0);
Expand All @@ -2496,6 +2496,11 @@ NO_INLINE JsVar *jspeStatementSwitch() {
if (execute) execInfo.execute=EXEC_YES|EXEC_IN_SWITCH|preservedExecState;
// we do the match after setting execute so that we're definitely allocating a string (we don't if we're not executing)
JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_R_CASE, jsvUnLock(switchOn), 0);
#ifdef USE_DEBUGGER
if ((execInfo.execute&EXEC_DEBUGGER_NEXT_LINE) && JSP_SHOULD_EXECUTE) {
jsiDebuggerLoop();
}
#endif
JsVar *test = jspeAssignmentExpression();
execInfo.execute = oldFlags|EXEC_IN_SWITCH;
JSP_MATCH_WITH_CLEANUP_AND_RETURN(':', jsvUnLock2(switchOn, test), 0);
Expand Down

0 comments on commit 7105ca3

Please sign in to comment.