Skip to content

Commit f79a982

Browse files
authored
Simplify visits with optional names (#1145)
1 parent 9fa5c65 commit f79a982

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/src/source_visitor.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,10 +1250,7 @@ class SourceVisitor extends ThrowingAstVisitor {
12501250

12511251
// Don't put a space after `extension` if the extension is unnamed. That
12521252
// way, generic unnamed extensions format like `extension<T> on ...`.
1253-
if (node.name != null) {
1254-
space();
1255-
token(node.name);
1256-
}
1253+
token(node.name, before: space);
12571254

12581255
visit(node.typeParameters);
12591256
soloSplit();
@@ -2022,8 +2019,7 @@ class SourceVisitor extends ThrowingAstVisitor {
20222019
_simpleStatement(node, () {
20232020
token(node.libraryKeyword);
20242021
if (node.name2 != null) {
2025-
space();
2026-
visit(node.name2);
2022+
visit(node.name2, before: space);
20272023
}
20282024
});
20292025
}

0 commit comments

Comments
 (0)