File tree Expand file tree Collapse file tree 3 files changed +44
-23
lines changed
Expand file tree Collapse file tree 3 files changed +44
-23
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,14 @@ module.exports = function () {
2727 }
2828
2929 function inferName ( path , node ) {
30- if ( node && node . name ) {
31- comment . name = node . name ;
32- return true ;
30+ if ( node ) {
31+ if ( node . name ) {
32+ comment . name = node . name ;
33+ return true ;
34+ } else if ( node . type === 'StringLiteral' ) {
35+ comment . name = node . value ;
36+ return true ;
37+ }
3338 }
3439 }
3540
@@ -45,6 +50,7 @@ module.exports = function () {
4550 // infer the named based on the `property` of the MemberExpression (`bar`)
4651 // rather than the `object` (`foo`).
4752 comment . context . ast . traverse ( {
53+
4854 /**
4955 * Attempt to extract the name from an Identifier node.
5056 * If the name can be resolved, it will stop traversing.
@@ -57,6 +63,7 @@ module.exports = function () {
5763 path . stop ( ) ;
5864 }
5965 } ,
66+
6067 /**
6168 * Attempt to extract the name from an Identifier node.
6269 * If the name can be resolved, it will stop traversing.
Original file line number Diff line number Diff line change 2222 "concat-stream" : " ^1.5.0" ,
2323 "debounce" : " ^1.0.0" ,
2424 "disparity" : " ^2.0.0" ,
25- "doctrine" : " ^1.1 .0" ,
25+ "doctrine" : " ^1.2 .0" ,
2626 "events" : " ^1.1.0" ,
2727 "extend" : " ^3.0.0" ,
2828 "get-comments" : " ^1.0.1" ,
Original file line number Diff line number Diff line change 1- /**
2- * This is my class, a demo thing.
3- * @class MyClass
4- * @property {number } howMany how many things it contains
5- */
6- function MyClass ( ) {
7- this . howMany = 2 ;
8- }
9-
10- /**
11- * Get the number 42
12- * @param {boolean } getIt whether to get the number
13- * @returns {number } forty-two
14- */
15- MyClass . prototype . getFoo = function ( getIt ) {
16- return getIt ? 42 : 0 ;
17- } ;
1+ // /**
2+ // * This is my class, a demo thing.
3+ // * @class MyClass
4+ // * @property {number } howMany how many things it contains
5+ // */
6+ // function MyClass() {
7+ // this.howMany = 2;
8+ // }
9+ //
10+ // /**
11+ // * Get the number 42
12+ // * @param {boolean } getIt whether to get the number
13+ // * @returns {number } forty-two
14+ // */
15+ // MyClass.prototype.getFoo = function (getIt) {
16+ // return getIt ? 42 : 0;
17+ // };
18+ //
19+ // /**
20+ // * Get undefined
21+ // * @returns {undefined } does not return anything.
22+ // */
23+ // MyClass.prototype.getUndefined = function () { };
24+ //
25+ // /**
26+ // * A colon-separated name
27+ // * @returns {undefined } does not return anything.
28+ // */
29+ // MyClass.prototype['colon:name'] = function () { };
1830
1931/**
20- * Get undefined
32+ * A colon-separated name specified manually
33+ *
34+ * @name "colon:foo"
2135 * @returns {undefined } does not return anything.
2236 */
23- MyClass . prototype . getUndefined = function ( ) { } ;
37+ MyClass . prototype [ 'colon:foo' ] = function ( ) { } ;
You can’t perform that action at this time.
0 commit comments