Ensure a blank line between the directives and the declarations. (#1480)
Fix #1470.
diff --git a/lib/src/front_end/ast_node_visitor.dart b/lib/src/front_end/ast_node_visitor.dart
index 04d35f6..33919f9 100644
--- a/lib/src/front_end/ast_node_visitor.dart
+++ b/lib/src/front_end/ast_node_visitor.dart
@@ -95,6 +95,9 @@
sequence.visit(directive);
}
+ // Add a blank line between directives and declarations.
+ sequence.addBlank();
+
for (var declaration in node.declarations) {
var hasBody = declaration is ClassDeclaration ||
declaration is EnumDeclaration ||
@@ -312,7 +315,7 @@
@override
void visitCompilationUnit(CompilationUnit node) {
throw UnsupportedError(
- 'CompilationUnit should be handled directly by format().');
+ 'CompilationUnit should be handled directly by run().');
}
@override
diff --git a/test/tall/regression/0600/0616.unit b/test/tall/regression/0600/0616.unit
index 6e5e347..2331b53 100644
--- a/test/tall/regression/0600/0616.unit
+++ b/test/tall/regression/0600/0616.unit
@@ -7,8 +7,8 @@
Expect.equals(42, y(l[1]));
}
<<<
-### TODO(1470): Should insert blank line after import.
import "package:expect/expect.dart";
+
int Function() x = () => 42;
int Function(int Function()) y = (int Function() x) => x();
List<int Function()> l = <int Function()>[() => 42, x];
diff --git a/test/tall/regression/0700/0782.unit b/test/tall/regression/0700/0782.unit
index b4f2262..f47bd8c 100644
--- a/test/tall/regression/0700/0782.unit
+++ b/test/tall/regression/0700/0782.unit
@@ -7,6 +7,7 @@
#!/usr/bin/env dart
import 'dart:io';
+
// More code...
>>>
#!/usr/bin/env dart