File tree 5 files changed +25
-7
lines changed
5 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -9823,6 +9823,7 @@ It takes a ",
9823
9823
"todos": Array [],
9824
9824
},
9825
9825
Object {
9826
+ "async": true,
9826
9827
"augments": Array [],
9827
9828
"context": Object {
9828
9829
"loc": Object {
Original file line number Diff line number Diff line change @@ -82,13 +82,12 @@ test('inferKind', function() {
82
82
) . kind
83
83
) . toBe ( 'function' ) ;
84
84
85
- expect (
86
- inferKind (
87
- toComment (
88
- '/** Export default function */' + 'export default function foo() {}'
89
- )
90
- ) . kind
91
- ) . toBe ( 'function' ) ;
85
+ const asyncFunction = inferKind (
86
+ toComment ( '/** Async function */' + 'async function foo() {}' )
87
+ ) ;
88
+
89
+ expect ( asyncFunction . kind ) . toBe ( 'function' ) ;
90
+ expect ( asyncFunction . async ) . toBe ( true ) ;
92
91
93
92
expect (
94
93
inferKind ( toComment ( 'class Foo { /** set b */ set b(v) { } }' ) ) . kind
@@ -106,6 +105,12 @@ test('inferKind', function() {
106
105
'function'
107
106
) ;
108
107
108
+ const asyncMethod = inferKind (
109
+ toComment ( 'class Foo { /** b */ async b(v) { } }' )
110
+ ) ;
111
+ expect ( asyncMethod . kind ) . toBe ( 'function' ) ;
112
+ expect ( asyncMethod . async ) . toBe ( true ) ;
113
+
109
114
expect (
110
115
inferKind (
111
116
toComment ( function ( ) {
Original file line number Diff line number Diff line change @@ -72,6 +72,14 @@ test('parse - @arg', function() {});
72
72
73
73
test ( 'parse - @argument' , function ( ) { } ) ;
74
74
75
+ test ( 'parse - @async' , function ( ) {
76
+ expect (
77
+ evaluate ( function ( ) {
78
+ /** @async */
79
+ } ) [ 0 ] . async
80
+ ) . toBe ( true ) ;
81
+ } ) ;
82
+
75
83
test ( 'parse - @augments' , function ( ) {
76
84
expect (
77
85
evaluate ( function ( ) {
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ function inferKind(comment) {
25
25
comment . kind = 'class' ;
26
26
} else {
27
27
comment . kind = 'function' ;
28
+ if ( node . async ) {
29
+ comment . async = true ;
30
+ }
28
31
}
29
32
} else if ( t . isTypeAlias ( node ) ) {
30
33
comment . kind = 'typedef' ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ const flatteners = {
23
23
alias : flattenName ,
24
24
arg : synonym ( 'param' ) ,
25
25
argument : synonym ( 'param' ) ,
26
+ async : flattenBoolean ,
26
27
/**
27
28
* Parse tag
28
29
* @private
You can’t perform that action at this time.
0 commit comments