Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fix for supporting functions in functions #34

Closed
GoogleCodeExporter opened this issue Jul 21, 2015 · 5 comments
Closed

Small fix for supporting functions in functions #34

GoogleCodeExporter opened this issue Jul 21, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

The parser was not finding the methods withing objects declared in the
following way:

Foo = function(id)
{
   Foo.prototype.methodOne = function(bar) {
      alert(bar);
   };

   Foo.prototype.methodTwo = function(bar2) {
      alert(bar2);
   };
};

Simply modifying JsParse.js at line 295, inserting the following right
after the check for "this._findDocComment(fs)" fixed the issue:

      else if (this._findFunction(fs)) {

      }

What version of the product are you using? On what operating system?
jsdoctoolkit_1.3.0 / Windows XP


Original issue reported on code.google.com by bfatt...@gmail.com on 17 Sep 2007 at 9:46

@GoogleCodeExporter
Copy link
Author

I should note that it found "Foo", but neither "methodOne" or "methodTwo" even 
with
the "-a" param.  I don't know if this messes up (or causes huge recursion 
problems)
with other library styles, but it worked for the example above.

Original comment by bfatt...@gmail.com on 17 Sep 2007 at 9:51

@GoogleCodeExporter
Copy link
Author

I see the need for this but unfortunately it also causes 25 of the enclosed unit
tests to fail. I'll have to have a look at what the side effects are before 
applying
your patch.

Original comment by micmath on 17 Sep 2007 at 9:56

@GoogleCodeExporter
Copy link
Author

adding the following (similar) line after 351 of JsParse seems more promising...

else if (this._findFunction(fs)) {}

Original comment by micmath on 17 Sep 2007 at 10:36

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

The fix has been committed to revision 233 in the source repository.

Original comment by micmath on 17 Sep 2007 at 10:42

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Revision 236 has a slightly more complete solution because it takes into 
account the
fact that simple functions (contrast with methods) defined within an enclosing
function are defined if the enclosing function is called, something that can 
only
ever be determined at runtime (and JsDoc does not run code). So, these secondary
types of functions are ignored by the parser.

Original comment by micmath on 17 Sep 2007 at 11:17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant