Re: [Jsdoc-user] no jsdoc from valid javscript
Status: Inactive
Brought to you by:
mmathews
From: Gabriel R. <gab...@gm...> - 2006-07-31 18:14:16
|
On Sun, Jul 30, 2006 at 09:10:28PM +0200, Henrik Gemal wrote: > Gabriel Reid wrote: > >On Thu, Jul 27, 2006 at 08:29:58AM +0200, Henrik Gemal wrote: > > > >>If I have valid JavaScript like this: > >> > >>var DED = function() { > >> var private_var; > >> function private_method() {} > >> return { > >> public_var: 1, > >> public_method : function() {} > >> }; > >>}(); > >> > >>I dont get any jsdocs out: > >>Loading sources from test.js > >>Nothing to document, exiting > >>What can I do? > >> > >> > > > >If you change the first line of this to: > > > > var DED = new function(){ > > > >then you should get results much closer to what you're expecting, > >without changing the functionality of your JavaScript code. The "new" > >keyword here is unfortunately an extra hint that the current incarnation > >of JSDoc needs in order to document this code. > > > It's correct that if I use "new function", I no longer get no jsdocs. > But if you try to generate JSDoc from: > > var bla = new function() { > var priv = 1; > return { > tester : function() {}, > } > }(); > > The "tester" function isn't mentioned. Isn't this a bug? Yes, this could indeed be considered a bug. Unfortunately, it's not a bug that is likely to be fixed in the near future (at least not in the current incarnation of JSDoc). The current version lacks a real JavaScript parser, making it very difficult to handle constructs such as this one. Regards, Gabriel |