google / tern-closure

A Tern plugin adding Closure support.
Apache License 2.0
33 stars 18 forks source link

TypeError: Cannot read property 'name' of null #33

Closed MetaMemoryT closed 10 years ago

MetaMemoryT commented 10 years ago

was trying to parse this file: https://gist.github.com/MetaMemoryT/e9b98d89c62ec7aec5a1

and got an error that was not very descriptive

it would be nice if it would tell what line of the input file it failed at

$ /c/nodejs/node_modules/tern/bin/condense --name "sqljs-substring" --plugin /c/Users/Sean/s/eclipse-luna/eclipse-standard-luna-R-win32-x86_64/eclipse/plugins/tern.core_ 0.6.0.201409182110/node_modules/tern/node_modules/tern-closure/closure.js --def helpers.json sql.js/coffee/api.js > sqljs-substring.json
C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\tern-closure\node_modules\doctrine\doctrine.js:1761
                    if (isParamTitle(this._title) && this._tag.type.name) {
                                                                   ^
TypeError: Cannot read property 'name' of null
    at TagParser.parseName (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\tern-closure\node_modules\doctrine\doctrine.js:1761:68)
    at TagParser.parse (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\tern-closure\node_modules\doctrine\doctrine.js:1976:34)
    at parseTag (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\tern-closure\node_modules\doctrine\doctrine.js:1999:27)
    at Object.parse (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\tern-closure\node_modules\doctrine\doctrine.js:2071:23)
    at Comment.parse (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\tern-closure\lib\comment.js:40:26)
    at interpretComments (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\tern-closure\closure.js:209:11)
    at walk.simple.AssignmentExpression (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\tern-closure\closure.js:172:7)
    at c (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\acorn\util\walk.js:30:18)
    at Object.skipThrough (C:\nodejs\node_modules\tern\node_modules\acorn\util\walk.js:163:39)
    at c (C:\Users\Sean\s\eclipse-luna\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\tern.core_0.6.0.201409182110\node_modules\tern\node_modules\acorn\util\walk.js:29:17)
jgiles commented 10 years ago

Thanks for the crash report! I've added some extra error output, so that you can identify the JSDoc comments causing these parse errors. In the case of your api.js, Doctrine (the JSDoc parser) didn't seem to like your @param tags. They don't really look like normal JSDoc tags to me either - we target the style used by the Closure compiler, which among other things uses curly braces for tags (e.g. @param {string}).

MetaMemoryT commented 10 years ago

Thanks, that looks great.