Skip to content

Commit e11604d

Browse files
committed
parse asnyc closures
1 parent 5edb201 commit e11604d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

grammar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,7 @@ module.exports = grammar({
12931293

12941294
closure_expression: $ => prec(PREC.closure, seq(
12951295
optional('static'),
1296+
optional('async'),
12961297
optional('move'),
12971298
field('parameters', $.closure_parameters),
12981299
choice(

test/corpus/async.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,37 @@ async move {}
8787
(async_block
8888
(block))))
8989

90+
================================================================================
91+
Async closure
92+
================================================================================
93+
94+
let _ = async || ();
95+
96+
--------------------------------------------------------------------------------
97+
98+
(source_file
99+
(let_declaration
100+
(closure_expression
101+
(closure_parameters)
102+
(unit_expression))))
103+
104+
================================================================================
105+
Async move async move closure
106+
================================================================================
107+
108+
let a = async move || async move {};
109+
110+
--------------------------------------------------------------------------------
111+
112+
(source_file
113+
(let_declaration
114+
(identifier)
115+
(closure_expression
116+
(closure_parameters)
117+
(async_block
118+
(block)))))
119+
120+
90121
================================================================================
91122
Try Block
92123
================================================================================

0 commit comments

Comments
 (0)