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 () {
27
27
}
28
28
29
29
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
+ }
33
38
}
34
39
}
35
40
@@ -45,6 +50,7 @@ module.exports = function () {
45
50
// infer the named based on the `property` of the MemberExpression (`bar`)
46
51
// rather than the `object` (`foo`).
47
52
comment . context . ast . traverse ( {
53
+
48
54
/**
49
55
* Attempt to extract the name from an Identifier node.
50
56
* If the name can be resolved, it will stop traversing.
@@ -57,6 +63,7 @@ module.exports = function () {
57
63
path . stop ( ) ;
58
64
}
59
65
} ,
66
+
60
67
/**
61
68
* Attempt to extract the name from an Identifier node.
62
69
* If the name can be resolved, it will stop traversing.
Original file line number Diff line number Diff line change 22
22
"concat-stream" : " ^1.5.0" ,
23
23
"debounce" : " ^1.0.0" ,
24
24
"disparity" : " ^2.0.0" ,
25
- "doctrine" : " ^1.1 .0" ,
25
+ "doctrine" : " ^1.2 .0" ,
26
26
"events" : " ^1.1.0" ,
27
27
"extend" : " ^3.0.0" ,
28
28
"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 () { };
18
30
19
31
/**
20
- * Get undefined
32
+ * A colon-separated name specified manually
33
+ *
34
+ * @name "colon:foo"
21
35
* @returns {undefined } does not return anything.
22
36
*/
23
- MyClass . prototype . getUndefined = function ( ) { } ;
37
+ MyClass . prototype [ 'colon:foo' ] = function ( ) { } ;
You can’t perform that action at this time.
0 commit comments