Bug 263468 - Wrong "Unreachable code" error decoration
Summary: Wrong "Unreachable code" error decoration
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.5   Edit
Assignee: Chris Jaun CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2009-02-03 10:18 EST by Michael Schneider CLA
Modified: 2010-03-03 11:14 EST (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
screenshot (6.24 KB, image/png)
2009-02-03 10:18 EST, Michael Schneider CLA
no flags Details
Updates in analyseCode() method of MethodDeclaration class. (1.17 KB, patch)
2009-04-28 18:47 EDT, Chris Jaun CLA
thatnitind: iplog+
thatnitind: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Schneider CLA 2009-02-03 10:18:33 EST
Created attachment 124551 [details]
screenshot

Eclipse Build ID: I20090129-1800
WTP Build ID: 3.1M4-20081219210304
Dojo Plugins: 1.0.0.v20080508-1557

1) create a javascript file, paste the following code:
(function() {
	function a(){
		return 0;
	}
	var x= a();
})();

observe: there's an error decoration indicating "Unreachable code". This is not expected. see attached screenshot

2) add a semicolon at the end of line 4
observe: now "};" is marked as unreachable code
Comment 1 Chris Jaun CLA 2009-04-28 18:47:30 EDT
Created attachment 133661 [details]
Updates in analyseCode() method of MethodDeclaration class.
Comment 2 Chris Jaun CLA 2009-04-28 18:48:48 EDT
Updated the analyseCode() method to handle the special case of a function declared inside another function.

This is similar to the way this is done CompiliationUnitDeclaration.

Can be patched in 3.0.5 and 3.1.

Will add junits for this tomorrow.
Comment 3 Nitin Dahyabhai CLA 2009-04-29 00:44:53 EDT
Approved.  Thanks, Chris.
Comment 4 Nitin Dahyabhai CLA 2009-04-29 00:45:12 EDT
.
Comment 5 Chris Jaun CLA 2009-04-29 09:32:03 EDT
Was there a problem with this patch Nitin?
Comment 6 Chris Jaun CLA 2009-05-13 15:58:05 EDT
Fixed.