Skip to content

Commit 565e8bf

Browse files
authored
Format await statements. (#1316)
1 parent 029f9d3 commit 565e8bf

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

lib/src/front_end/ast_node_visitor.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ class AstNodeVisitor extends ThrowingAstVisitor<void>
147147

148148
@override
149149
void visitAwaitExpression(AwaitExpression node) {
150-
throw UnimplementedError();
150+
token(node.awaitKeyword);
151+
space();
152+
visit(node.expression);
151153
}
152154

153155
@override

test/statement/other.stmt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,11 @@ Stream<int> i(int n) async* {
4747
Stream<int> i(int n) async* {
4848
yield* i(n - 1);
4949
}
50+
>>> Await.
51+
foo() async {
52+
await i ( 1 + 2 ) ;
53+
}
54+
<<<
55+
foo() async {
56+
await i(1 + 2);
57+
}

test/statement/other_comment.stmt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,11 @@ Stream<int> i(int n) async* {
5151
Stream<int> i(int n) async* {
5252
yield* i(x); // comment
5353
}
54+
>>> Await with comment after semicolon.
55+
foo() async {
56+
await i ( 1 + 2 ) ; // comment
57+
}
58+
<<<
59+
foo() async {
60+
await i(1 + 2); // comment
61+
}

0 commit comments

Comments
 (0)