Issue Details (XML | Word | Printable)

Key: FDT-47
Type: Bug Bug
Status: Confirmed Confirmed
Resolution: none
Priority: Minor Minor
Assignee: FDT Team
Reporter: Joa Ebert
Votes: 4
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
FDT

FDT does not evaluate all code paths for return values

Created: 22/Sep/08 06:15 PM   Updated: 08/Aug/12 05:05 PM
Component/s: Parser
Affects Version/s: FDT 4.5.2
Fix Version/s: FDT
Security Level: public

Time Tracking:
Not Specified

Environment: Windows
Issue Links:
Duplicate
 

Review Type: Review by Product Owner


 Description  « Hide
If a method has to return a value, FDT does not evaluate all code paths but just searches for any return statement.
Example:

function foo(): Bar

{ if(Math.random() > 0.5) return new Bar(); }

FDT shows no error, but of course that method is completly wrong.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Arne Deutsch added a comment - 24/Sep/08 03:51 PM
Changed priority to "minor" ... this would be nice to have but does not result in a major loss of functionality.

Alan K (Deprecated) added a comment - 08/Dec/11 07:44 PM
public function get someProperty() : int {
			
			// fails
			// if(myNum > .5) return 10;
			// fails
			// var myNum : Number = Math.random();
			//  if(myNum > .5) return _someProperty;
			//fails
			// if (false) return 10;
			
		}

This is a bug in the parser, as none of these examples will compile.


Alan K (Deprecated) added a comment - 08/Dec/11 07:48 PM
This is a bug and moved over there.

FDT Team added a comment - 04/Jul/12 04:39 PM
fixed

Damien Laurent added a comment - 08/Aug/12 04:55 PM
Hi,

There is still an issue :

private function test() : int
{
    for each ( var frameLabel : FrameLabel in currentLabels )
    {
        if ( frameLabel.name == "something" )
            return frameLabel.frame;
    }
    // An error should be displayed here, cause a return statement is missing.
}