Skip to content

Commit 9b65a08

Browse files
committed
Fix augments
1 parent 75d4541 commit 9b65a08

7 files changed

+81
-6
lines changed

lib/infer/augments.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var generate = require('babel-generator').default,
1212
* @returns {Object} comment with kind inferred
1313
*/
1414
function inferAugments(comment/*: Comment */) {
15-
if (comment.augments) {
15+
if (comment.augments.length) {
1616
return comment;
1717
}
1818

@@ -25,10 +25,10 @@ function inferAugments(comment/*: Comment */) {
2525
* we can access a name like `path.node.superClass.name`
2626
*/
2727
if (path && path.node.superClass) {
28-
comment.augments = [{
28+
comment.augments.push({
2929
title: 'augments',
3030
name: generate(path.node.superClass).code
31-
}];
31+
});
3232
}
3333

3434
return comment;

test/fixture/es6-class.output.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@
7575
}
7676
}
7777
},
78-
"augments": [],
78+
"augments": [
79+
{
80+
"title": "augments",
81+
"name": "React.Component"
82+
}
83+
],
7984
"errors": [],
8085
"examples": [],
8186
"params": [],

test/fixture/es6-class.output.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
## Foo
1111

12+
**Extends React.Component**
13+
1214
This is my component. This is from issue #458
1315

1416
## Bar

test/fixture/es6-class.output.md.json

+18
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@
1515
}
1616
]
1717
},
18+
{
19+
"type": "paragraph",
20+
"children": [
21+
{
22+
"type": "strong",
23+
"children": [
24+
{
25+
"type": "text",
26+
"value": "Extends "
27+
},
28+
{
29+
"type": "text",
30+
"value": "React.Component"
31+
}
32+
]
33+
}
34+
]
35+
},
1836
{
1937
"type": "paragraph",
2038
"children": [

test/fixture/inheritance.output.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@
7575
}
7676
}
7777
},
78-
"augments": [],
78+
"augments": [
79+
{
80+
"title": "augments",
81+
"name": "Array"
82+
}
83+
],
7984
"errors": [],
8085
"examples": [],
8186
"params": [],
@@ -132,7 +137,12 @@
132137
}
133138
}
134139
},
135-
"augments": [],
140+
"augments": [
141+
{
142+
"title": "augments",
143+
"name": "Bar"
144+
}
145+
],
136146
"errors": [
137147
{
138148
"message": "@memberof reference to module not found",

test/fixture/inheritance.output.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
## SpecialArray
99

10+
**Extends Array**
11+
1012
With ES6, built-in types are extensible!
1113

1214
## Foo
15+
16+
**Extends Bar**

test/fixture/inheritance.output.md.json

+36
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@
1515
}
1616
]
1717
},
18+
{
19+
"type": "paragraph",
20+
"children": [
21+
{
22+
"type": "strong",
23+
"children": [
24+
{
25+
"type": "text",
26+
"value": "Extends "
27+
},
28+
{
29+
"type": "text",
30+
"value": "Array"
31+
}
32+
]
33+
}
34+
]
35+
},
1836
{
1937
"type": "paragraph",
2038
"children": [
@@ -59,6 +77,24 @@
5977
"value": "Foo"
6078
}
6179
]
80+
},
81+
{
82+
"type": "paragraph",
83+
"children": [
84+
{
85+
"type": "strong",
86+
"children": [
87+
{
88+
"type": "text",
89+
"value": "Extends "
90+
},
91+
{
92+
"type": "text",
93+
"value": "Bar"
94+
}
95+
]
96+
}
97+
]
6298
}
6399
]
64100
}

0 commit comments

Comments
 (0)