Bug 217007 - Used variable is marked as unused, if it's used as value of property in literal object
Used variable is marked as unused, if it's used as value of property in liter...
Status: RESOLVED DUPLICATE of bug 218090
Product: javascript
Classification: Unclassified
Component: Editor
7.3
PC Linux
: P3 (vote)
: 7.3
Assigned To: Petr Pisl
issues@javascript
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-17 08:44 UTC by Petr Pisl
Modified: 2012-09-12 08:43 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2012-08-17 08:44:48 UTC
Try this code

/*global console, MyClass, MyFunc,*/
MyClass = {
    foo: null,
    init: function() {
        'use strict';
  
       var getsUsed = 'fubar';      // <- marked as unused

        this.foo = new MyFunc({
            'useful': getsUsed
        });
    }
};
Comment 1 fordfrog 2012-08-17 12:52:12 UTC
there are also some other cases when variables are marked as unused though they are used:

var Core = Core || {};

Core.needModules(function () {
    "use strict";

    var REGEXP = /^[+]?\d{1,20}$/; // REGEXP marked as unused

    Core.Test = {
        test: function (value) {
            var fieldType; // fieldType marked as unused

            alert(REGEXP.test(value));

            switch (fieldType) {
            case "test":
                alert(REGEXP.test(value));
                break;
            }
        }
    };
});
Comment 2 Petr Pisl 2012-09-12 08:43:23 UTC
The first case fixed as duplicate of #218090. The Fordfrog's case needs to be still fixed. I will separate it in the new issue.

*** This bug has been marked as a duplicate of bug 218090 ***


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo