@@ -219,6 +219,18 @@ class AstNodeVisitor extends ThrowingAstVisitor<Piece> with PieceFactory {
219
219
throw UnimplementedError ();
220
220
}
221
221
222
+ @override
223
+ Piece visitCaseClause (CaseClause node) {
224
+ return buildPiece ((b) {
225
+ b.token (node.caseKeyword);
226
+ if (node.guardedPattern.whenClause != null ) {
227
+ throw UnimplementedError ();
228
+ }
229
+ b.space ();
230
+ b.visit (node.guardedPattern.pattern);
231
+ });
232
+ }
233
+
222
234
@override
223
235
Piece visitCastPattern (CastPattern node) {
224
236
throw UnimplementedError ();
@@ -1022,11 +1034,14 @@ class AstNodeVisitor extends ThrowingAstVisitor<Piece> with PieceFactory {
1022
1034
void traverse (Token ? precedingElse, IfStatement ifStatement) {
1023
1035
var condition = buildPiece ((b) {
1024
1036
b.token (precedingElse, spaceAfter: true );
1025
- b.add (startControlFlow (
1026
- ifStatement.ifKeyword,
1027
- ifStatement.leftParenthesis,
1028
- ifStatement.expression,
1029
- ifStatement.rightParenthesis));
1037
+ b.token (ifStatement.ifKeyword);
1038
+ b.space ();
1039
+ b.token (ifStatement.leftParenthesis);
1040
+ b.add (buildPiece ((b) {
1041
+ b.visit (ifStatement.expression);
1042
+ b.visit (ifStatement.caseClause, spaceBefore: true );
1043
+ }));
1044
+ b.token (ifStatement.rightParenthesis);
1030
1045
b.space ();
1031
1046
});
1032
1047
0 commit comments