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 252022 - False-positive warning "The global variable "xxx" is not declared."
Summary: False-positive warning "The global variable "xxx" is not declared."
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-23 13:28 UTC by NukemBy
Modified: 2015-05-05 03:27 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
False-positive-global-variable-not-declared.png (6.32 KB, image/png)
2015-04-23 13:28 UTC, NukemBy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NukemBy 2015-04-23 13:28:04 UTC
Created attachment 153325 [details]
False-positive-global-variable-not-declared.png

I get False-positive warning "The global variable "fn2" is not declared." for invocation of fn2 in this statement "fn2().toLowerCase();". After removing of ".toLowerCase();" warning disappears.

See screenshot for details. Occurs in NetBeans IDE Dev (Build 201504230001)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

/**
 * @constructor
 */
var MyLib = new function MyLib() {
    
    function fn1() {
        fn2().toLowerCase();
        return "";
    }

    /**
     * @returns {string}
     */
    function fn2() {
        return "";
    }
};
Comment 1 NukemBy 2015-05-03 22:11:30 UTC
I've got another use-case. Not sure if is the same or different in terms of internal implementation, but complain from NB is the same - The global variable "xxx" is not declared.

Appears in line "this.xxx = xxx;" where right-hand-side 'xxx' is reference to local 'var xxx', but is highlighted as 'unknown global'. Running in NetBeans IDE Dev (Build 201505010001)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

var MyLib = new function MyLib() {
    var functions = {
        fn1: function MyLib_fn1(data, id) {
            var xxx = data[id];
            
            this.xxx = xxx;
        }
    };
};
Comment 2 Petr Pisl 2015-05-04 14:32:42 UTC
The second case is caused by different problem. I created new issue #252232.
Comment 3 Petr Pisl 2015-05-04 14:49:23 UTC
Fixed in web-main.
Comment 4 Quality Engineering 2015-05-05 03:27:58 UTC
Integrated into 'main-silver', will be available in build *201505050001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/444bb664761a
User: Petr Pisl <ppisl@netbeans.org>
Log: #252022 - False-positive warning "The global variable "xxx" is not declared.