Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353306 - Unlabeled exit in "if" statement results in "return;"
Summary: Unlabeled exit in "if" statement results in "return;"
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-28 07:29 EDT by Scott Greer CLA
Modified: 2017-02-23 14:16 EST (History)
1 user (show)

See Also:


Attachments
FVT testcase (2.90 KB, text/plain)
2011-07-28 07:29 EDT, Scott Greer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.