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 237872 - editor reports unused function when it is used via function.bind alone
Summary: editor reports unused function when it is used via function.bind alone
Status: RESOLVED WORKSFORME
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-31 20:52 UTC by rickb
Modified: 2015-06-22 14:35 UTC (History)
0 users

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 rickb 2013-10-31 20:52:59 UTC
In the code below the printIt function is most certainly used however netbeans 7.4 reports it as unused.

(function(){


	doStuff();

	function doStuff()
	{
		var likeCake = printIt.bind(this, " likes cake");
		["mary", "erica", "abigail", "sophie"].forEach(likeCake);
	}


	function printIt(msg, s)
	{
		console.log(s + msg);
	}

})();
Comment 1 Petr Pisl 2013-11-01 09:25:41 UTC
It looks like that there are two objects printIt in the model. If we change the source 

(function(){

	doStuff();

	function printIt(msg, s)
	{
		console.log(s + msg);
	}

        function doStuff()
	{
		var likeCake = printIt.bind(this, " likes cake");
		["mary", "erica", "abigail", "sophie"].forEach(likeCake);
	}
})();

that the definition is first and the usage later, then it works. So IMHO the problem is that the function definitions doesn't look for usages before the definition.
Comment 2 Roman Svitanic 2015-06-22 14:35:54 UTC
Not reproducible:

Product Version: NetBeans IDE Dev (Build 20150622-3159206f97b3)
Java: 1.7.0_80; Java HotSpot(TM) 64-Bit Server VM 24.80-b11
Runtime: Java(TM) SE Runtime Environment 1.7.0_80-b15
System: Mac OS X version 10.10.3 running on x86_64; UTF-8; en_US (nb)