Skip to content

Commit

Permalink
Improve comment typedef while we're at it
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Jan 29, 2017
1 parent c99bbe2 commit 121803b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 16 additions & 3 deletions declarations/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,19 @@ declare type Remark = {
children: Array<Object>
};

declare type Access = 'private' | 'public' | 'protected';
declare type Scope = 'instance' | 'static' | 'inner' | 'global';
declare type Kind = 'class' |
'constant' |
'event' |
'external' |
'file' |
'function' |
'member' |
'mixin' |
'module' |
'namespace' |
'typedef';

declare type Comment = {
errors: Array<CommentError>,
Expand All @@ -110,10 +122,11 @@ declare type Comment = {
members: CommentMembers,

name?: string,
kind?: string,
kind?: Kind,

memberof?: string,
scope?: Scope,
access?: string,
access?: Access,
alias?: string,

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

declare type ReducedComment = {
name: string,
kind: ?string,
kind: ?Kind,
scope?: ?Scope
}
2 changes: 2 additions & 0 deletions lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var flatteners = {
* @returns {undefined} has side-effects
*/
'access': function (result, tag) {
// doctrine ensures that tag.access is valid
result.access = tag.access;
},
'alias': flattenName,
Expand Down Expand Up @@ -208,6 +209,7 @@ var flatteners = {
* @returns {undefined} has side-effects
*/
'kind': function (result, tag) {
// doctrine ensures that tag.kind is valid
result.kind = tag.kind;
},
'lends': flattenDescription,
Expand Down

0 comments on commit 121803b

Please sign in to comment.