Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353306

Summary: Unlabeled exit in "if" statement results in "return;"
Product: z_Archived Reporter: Scott Greer <greer>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jeffdouglas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
FVT testcase none

Description Scott Greer CLA 2011-07-28 07:29:28 EDT
Created attachment 200522 [details]
FVT testcase

In TestExitStatementLib (from the FVT testcases), there's this test:

		// Test default exit within IF block
		counter = 1;
		if ( true )
			exit;
			counter = 0;
		end

Both Java and JavaScript generators produce code that replace the unlabeled exit with a return statement, e.g.

			counter = 1;
			EzeLabel_7: if (true) {
				return ;
				counter = 0;
			}

I've attached the FVT testcase.
Comment 1 Jeff Douglas CLA 2011-07-28 08:29:36 EDT
Logic has been added to check for this situation
Comment 2 Scott Greer CLA 2011-08-01 10:33:05 EDT
Verified.