Crashes for generator method with computed name #107

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

Comments

Projects
None yet
4 participants
@andy-hanson

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

This comment has been minimized.

Show comment
Hide comment
@h13i32maru

h13i32maru Oct 10, 2015

Member

@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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@h13i32maru

h13i32maru Oct 18, 2015

Member

I published v0.4.1 that fixed this issue.

Member

h13i32maru commented Oct 18, 2015

I published v0.4.1 that fixed this issue.

@aureooms

This comment has been minimized.

Show comment
Hide comment
@aureooms

aureooms Jul 21, 2016

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

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

@typhonrt

This comment has been minimized.

Show comment
Hide comment
@typhonrt

typhonrt Jul 22, 2016

Contributor

@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.

Contributor

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