This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 217007 - Used variable is marked as unused, if it's used as value of property in literal object
Summary: Used variable is marked as unused, if it's used as value of property in liter...
Status: RESOLVED DUPLICATE of bug 218090
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
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
Exception Reporter:


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 ***