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

Bug 361132

Summary: Generate java contains compile error if funtion return statement is in condition statement
Product: z_Archived Reporter: Paul Harmon <pharmon>
Component: EDTAssignee: Tim Wilson <tww>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas, kroyeren, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Paul Harmon CLA 2011-10-17 09:22:22 EDT
The following EGL results in java with compile errors being generated.

// basic program
//
program pgm2 type BasicProgram {}
	
	
	function main()
		f1();
	end
	
	function f1() returns (boolean)
		if (1 == 2)
			return (true);
		end
	end
	
end


The java generated for function f1() is as follows (notice that there is no return statement generated outside of the IF block:

	public boolean f1() {
		if (((short) 1 == (short) 2)) {
			return true;
		}
	}
Comment 1 Jeff Douglas CLA 2011-10-19 11:24:44 EDT
lowering to P3 as this is not a stopper
Comment 2 Jeff Douglas CLA 2011-10-21 09:50:21 EDT
This problem is because there is no analysis logic built into EDT to determine when to 1) add return statements or 2) remove dead code.
Comment 3 Morten Krøyer CLA 2012-02-14 08:41:56 EST
Browsing bugs I stumpled upon this one and wondered what the desired outcome of the EGL code would be. 

Might be because I'm new to EGL, but I would assume an EGL-compile-error, from this statement. (for the same reason the Java compiler generate an error)

Anyway you might as well do: 

function f1() returns (boolean)
return(1==2)
end
Comment 4 Matt Heitz CLA 2013-01-03 14:01:45 EST
Deferring to Future.  This won't be done in 0.8.2.