Simplify visits with optional names (#1145)
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index f6cc74a..e376310 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -1250,10 +1250,7 @@
// Don't put a space after `extension` if the extension is unnamed. That
// way, generic unnamed extensions format like `extension<T> on ...`.
- if (node.name != null) {
- space();
- token(node.name);
- }
+ token(node.name, before: space);
visit(node.typeParameters);
soloSplit();
@@ -2022,8 +2019,7 @@
_simpleStatement(node, () {
token(node.libraryKeyword);
if (node.name2 != null) {
- space();
- visit(node.name2);
+ visit(node.name2, before: space);
}
});
}