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

Summary: Used variable is marked as unused, if it's used as value of property in literal object
Product: javascript Reporter: Petr Pisl <ppisl>
Component: EditorAssignee: Petr Pisl <ppisl>
Status: RESOLVED DUPLICATE    
Severity: normal CC: tboudreau, vriha
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

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