Skip to content

Commit 121803b

Browse files
committed
Improve comment typedef while we're at it
1 parent c99bbe2 commit 121803b

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

declarations/comment.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,19 @@ declare type Remark = {
8686
children: Array<Object>
8787
};
8888

89+
declare type Access = 'private' | 'public' | 'protected';
8990
declare type Scope = 'instance' | 'static' | 'inner' | 'global';
91+
declare type Kind = 'class' |
92+
'constant' |
93+
'event' |
94+
'external' |
95+
'file' |
96+
'function' |
97+
'member' |
98+
'mixin' |
99+
'module' |
100+
'namespace' |
101+
'typedef';
90102

91103
declare type Comment = {
92104
errors: Array<CommentError>,
@@ -110,10 +122,11 @@ declare type Comment = {
110122
members: CommentMembers,
111123

112124
name?: string,
113-
kind?: string,
125+
kind?: Kind,
126+
114127
memberof?: string,
115128
scope?: Scope,
116-
access?: string,
129+
access?: Access,
117130
alias?: string,
118131

119132
copyright?: string,
@@ -136,6 +149,6 @@ declare type Comment = {
136149

137150
declare type ReducedComment = {
138151
name: string,
139-
kind: ?string,
152+
kind: ?Kind,
140153
scope?: ?Scope
141154
}

lib/parse.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var flatteners = {
2121
* @returns {undefined} has side-effects
2222
*/
2323
'access': function (result, tag) {
24+
// doctrine ensures that tag.access is valid
2425
result.access = tag.access;
2526
},
2627
'alias': flattenName,
@@ -208,6 +209,7 @@ var flatteners = {
208209
* @returns {undefined} has side-effects
209210
*/
210211
'kind': function (result, tag) {
212+
// doctrine ensures that tag.kind is valid
211213
result.kind = tag.kind;
212214
},
213215
'lends': flattenDescription,

0 commit comments

Comments
 (0)