Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351348 - [validation] False "variable is never read" warning with certain variable names
Summary: [validation] False "variable is never read" warning with certain variable names
Status: RESOLVED WORKSFORME
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Chris Jaun CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-06 11:50 EDT by Klaus Reimer CLA
Modified: 2013-08-01 13:39 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Reimer CLA 2011-07-06 11:50:50 EDT
Build Identifier: I20110613-1736

The following small code generates a "variable location is never read" warning which is wrong because the variable IS read.

    function test()
    {
        var location;
        
        location = { foo: 42 };
        return location.foo;
    }

Interesting facts:

  1. It does NOT happen when returning location["foo"] instead of location.foo.

  2. It does NOT happen when using a different variable name. It is reproducible with "location" and "window" and "document" (and may be others) but not with variable names which doesn't collide with pre-defined top-level variables. So maybe this warning collides with the "hides another field or variable" warning? But I couldn't reproduce it with a custom variable name which is also defined in the global scope.


Reproducible: Always
Comment 1 Chris Jaun CLA 2013-08-01 13:39:04 EDT
This is working correctly in WTP 3.5.1. Checked against 7/18 build.