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 219508 - Support for JavaScript new function() singleton pattern
Summary: Support for JavaScript new function() singleton pattern
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC All
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-04 09:57 UTC by Eccenux
Modified: 2013-08-19 10:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Singleton pattern used in my project. Note that (210 bytes, application/x-javascript)
2012-10-04 09:57 UTC, Eccenux
Details
another test file (463 bytes, application/x-javascript)
2013-08-01 11:43 UTC, Eccenux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eccenux 2012-10-04 09:57:26 UTC
Created attachment 125370 [details]
Singleton pattern used in my project. Note that

I'm using a pattern in which you define and create an anonymous class and write it to an object (`SomeSingleton = new function (){...}`). Example attached.

Netbeans 7.3 bet editor is better in that it recognizes a private function, but the problem is it doesn't attach any functions or variables (properties) to the singleton class. It shows it as undefined and other functions and properties are on the same level.

Due to this behavior autocomplete for the singleton doesn't work.
Comment 1 Petr Pisl 2013-07-19 10:52:01 UTC
fixed in web-main:
http://hg.netbeans.org/web-main/rev/36c286201fb4
Comment 2 Quality Engineering 2013-07-20 02:09:48 UTC
Integrated into 'main-silver', will be available in build *201307192300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/36c286201fb4
User: Petr Pisl <ppisl@netbeans.org>
Log: #219508 - Support for JavaScript new function() singleton pattern
Comment 3 Eccenux 2013-08-01 11:43:01 UTC
Created attachment 138113 [details]
another test file

Strange @class tag in comment above the declaration breaks parsing apart. Not sure if this is a bug but all public methods and variables appear to be treated as kind of global. Kind of because autocomplete still works in mentioned nightly.

It doesn't work at all in 7.4 beta (using PHP build in both cases).
Comment 4 Petr Pisl 2013-08-19 10:52:51 UTC
This is already fixed. Added test for it. http://hg.netbeans.org/web-main/rev/6dc8e0cd72c5