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.
Created attachment 150887 [details] NetBeans 7.4 (correct) and 8.0.2 (wrong) Variables are incorrectly highlighted as unused or as global variables in functions, example: function myFunction(param) { var f = param.f || function () {}, // usage is correctly detected a = param.a || 1; // usage is correctly detected var g = function () { f(); console.log(a); }; g(); } myFunction({a: 4}); The two screenshots show the wrong behaviour in NetBeans 8.0.2 and the correct behaviour in NetBeans 7.4
Reproducible, thank you for reporting Product Version: NetBeans IDE Dev (Build 201412050001) Java: 1.7.0_71; Java HotSpot(TM) Client VM 24.71-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_71-b14 System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
If it could be useful to track down the problem, i checked the code above in NetBeans 8.0 WITHOUT UPDATES on another machine and the bug DOESN'T show, the Help -> About dialog says: Product Version: NetBeans IDE 8.0 (Build 201403101706) Updates: Updates available Java: 1.8.0_25; Java HotSpot(TM) 64-Bit Server VM 25.25-b02 Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b17 System: Linux version 3.8.0-44-generic running on amd64; UTF-8; it_IT (nb) Regards, Dario
The problem is in the definition of variable f. If the definition will be without the function () {}, then it works correctly. So expression function () {} cased the problem.
Fixed in web-main. Should be ok now.
Integrated into 'main-silver', will be available in build *201412100001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/f58c8c5a4745 User: Petr Pisl <ppisl@netbeans.org> Log: #249119 - Incorrect highlighting for variables
Hi, thank you very much for the fix, will it be available through the normal update channel?
The fix is not complicated. It can be integrated in a patch, if there will be. I'm not sure now.