Bug 18671

Summary: SquirrelFish: continue inside switch fails
Product: WebKit Reporter: Oliver Hunt <oliver>
Component: JavaScriptCoreAssignee: Cameron Zwarich (cpst) <zwarich>
Status: RESOLVED FIXED    
Severity: Normal CC: ggaren, mjs, oliver, zwarich
Priority: P2 Keywords: EasyFix
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Proposed patch
oliver: review+
Revised proposed patch oliver: review+

Oliver Hunt
Reported 2008-04-21 15:46:13 PDT
Valid continue statements fail inside a switch statement while(1) { print("foo"); switch(1) { case 1: continue; } } The problem is that getJumpContext with an empty label will return the nearest JumpContext, but in the case of continue it needs to return the nearest JumpContext with a continue target.
Attachments
Proposed patch (2.84 KB, patch)
2008-04-21 16:20 PDT, Cameron Zwarich (cpst)
oliver: review+
Revised proposed patch (2.86 KB, patch)
2008-04-21 16:32 PDT, Cameron Zwarich (cpst)
oliver: review+
Cameron Zwarich (cpst)
Comment 1 2008-04-21 16:20:40 PDT
Created attachment 20741 [details] Proposed patch Here is a fix.
Oliver Hunt
Comment 2 2008-04-21 16:23:48 PDT
Comment on attachment 20741 [details] Proposed patch I'd prefer: + if (forContinue) { + for (int i = m_jumpContextStack.size() - 1; i >= 0; i--) { + JumpContext* scope = &m_jumpContextStack[i]; + if (scope->continueTarget) + return scope; + } + return 0; + } But other than that, r=me
Cameron Zwarich (cpst)
Comment 3 2008-04-21 16:32:04 PDT
Created attachment 20742 [details] Revised proposed patch Modified as per Oliver's suggestion.
Note You need to log in before you can comment on or make changes to this bug.