Skip to content

Commit 6b9168b

Browse files
authored
feat: Add modifier for getters and setters (#287)
1 parent 3768744 commit 6b9168b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/__tests__/__snapshots__/main-test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Object {
1717
"docblock": null,
1818
"modifiers": Array [
1919
"static",
20+
"get",
2021
],
2122
"name": "displayName",
2223
"params": Array [],
@@ -26,6 +27,7 @@ Object {
2627
"docblock": null,
2728
"modifiers": Array [
2829
"static",
30+
"get",
2931
],
3032
"name": "defaultProps",
3133
"params": Array [],

src/utils/getMethodDocumentation.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ function getMethodModifiers(methodPath) {
8787
modifiers.push('static');
8888
}
8989

90+
if (methodPath.node.kind === 'get' || methodPath.node.kind === 'set') {
91+
modifiers.push(methodPath.node.kind);
92+
}
93+
9094
const functionExpression = methodPath.get('value').node;
9195
if (functionExpression.generator) {
9296
modifiers.push('generator');

0 commit comments

Comments
 (0)