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

Crashes for generator method with computed name #107

Closed
andy-hanson opened this issue Oct 7, 2015 · 4 comments
Closed

Crashes for generator method with computed name #107

andy-hanson opened this issue Oct 7, 2015 · 4 comments

Comments

@andy-hanson
Copy link

@andy-hanson andy-hanson commented Oct 7, 2015

Run this code in an empty directory:

echo '{"source": "./src", "destination": "./esdoc"}' > esdoc.json
mkdir src
echo 'export default class A { * [Symbol.iterator]() { } }' > src/index.js
esdoc -c esdoc.json

This is the response I get:

/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/out/src/Publisher/Builder/DocResolver.js:121
          if (autoPrivate && this.name.charAt(0) === '_') {
                                      ^

TypeError: Cannot read property 'charAt' of undefined
    at Object.<anonymous> (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/out/src/Publisher/Builder/DocResolver.js:121:39)
    at /home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/node_modules/taffydb/taffy.js:743:17
    at each (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/node_modules/taffydb/taffy.js:126:17)
    at Object.<anonymous> (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/node_modules/taffydb/taffy.js:740:7)
    at Object.API.(anonymous function) [as update] (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/node_modules/taffydb/taffy.js:166:18)
    at DocResolver._resolveAccess (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/out/src/Publisher/Builder/DocResolver.js:119:20)
    at DocResolver.resolve (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/out/src/Publisher/Builder/DocResolver.js:51:12)
    at CoverageBuilder.DocBuilder (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:57:42)
    at new CoverageBuilder (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/out/src/Publisher/Builder/CoverageBuilder.js:33:81)
    at publish (/home/andy/.nvm/versions/node/v4.1.2/lib/node_modules/esdoc/out/src/Publisher/publish.js:164:5)

It does work for a named generator method or for a normal method with computed name.

Tested on esdoc 0.4.0.

@h13i32maru
Copy link
Member

@h13i32maru h13i32maru commented Oct 10, 2015

@andy-hanson Hi Thanks for this issue. And sorry for late reply.
I reproduced it. But I think that it is espree bug.
Please wait a moment.

h13i32maru added a commit that referenced this issue Oct 18, 2015
@h13i32maru
Copy link
Member

@h13i32maru h13i32maru commented Oct 18, 2015

I published v0.4.1 that fixed this issue.

@aureooms
Copy link

@aureooms aureooms commented Jul 21, 2016

Still bugs with MyClass.prototype[Symbol.iterator] = function* () {};

@typhonrt
Copy link
Contributor

@typhonrt typhonrt commented Jul 22, 2016

@aureooms this should be reduced to not crashing with the recent fix to #297 which is related, but currently ESDoc doesn't add methods added by the prototype to the documentation of the class. This will add an unexported function doc to what is generated.

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.