Upgrade to analyzer 0.27.0.

Also supports (and formats) the new config-specific code syntax.

R=kevmoo@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org//1505983005 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 93ae7dd..f583c48 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+# 0.2.2
+
+* Upgrade to analyzer 0.27.0.
+* Format configured imports and exports.
+
 # 0.2.1
 
 * `--version` command line argument (#240).
diff --git a/bin/format.dart b/bin/format.dart
index 8d179c1..f6fd6c9 100644
--- a/bin/format.dart
+++ b/bin/format.dart
@@ -14,7 +14,7 @@
 import 'package:dart_style/src/source_code.dart';
 
 // Note: The following line of code is modified by tool/grind.dart.
-const version = "0.2.1";
+const version = "0.2.2";
 
 void main(List<String> args) {
   var parser = new ArgParser(allowTrailingOptions: true);
diff --git a/lib/src/dart_formatter.dart b/lib/src/dart_formatter.dart
index 428aeec..a86c299 100644
--- a/lib/src/dart_formatter.dart
+++ b/lib/src/dart_formatter.dart
@@ -101,6 +101,8 @@
     // Parse it.
     var parser = new Parser(stringSource, errorListener);
 
+    parser.parseConditionalDirectives = true;
+
     var node;
     if (source.isCompilationUnit) {
       node = parser.parseCompilationUnit(startToken);
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index a34b367..10902b3 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -533,6 +533,26 @@
     builder.unnest();
   }
 
+  visitConfiguration(Configuration node) {
+    token(node.ifKeyword);
+    space();
+    token(node.leftParenthesis);
+    visit(node.name);
+
+    if (node.equalToken != null) {
+      builder.nestExpression();
+      space();
+      token(node.equalToken);
+      soloSplit();
+      visit(node.value);
+      builder.unnest();
+    }
+
+    token(node.rightParenthesis);
+    space();
+    visit(node.libraryUri);
+  }
+
   visitConstructorDeclaration(ConstructorDeclaration node) {
     visitMemberMetadata(node.metadata);
 
@@ -666,6 +686,17 @@
     builder.unnest();
   }
 
+  visitDottedName(DottedName node) {
+    for (var component in node.components) {
+      // Write the preceding ".".
+      if (component != node.components.first) {
+        token(component.beginToken.previous);
+      }
+
+      visit(component);
+    }
+  }
+
   visitDoubleLiteral(DoubleLiteral node) {
     token(node.literal);
   }
@@ -703,6 +734,8 @@
       space();
       visit(node.uri);
 
+      _visitConfigurations(node.configurations);
+
       builder.startRule(new CombinatorRule());
       visitNodes(node.combinators);
       builder.endRule();
@@ -1062,6 +1095,8 @@
       space();
       visit(node.uri);
 
+      _visitConfigurations(node.configurations);
+
       if (node.asKeyword != null) {
         soloSplit();
         token(node.deferredKeyword, after: space);
@@ -1997,6 +2032,20 @@
     _writeText(rightBracket.lexeme, rightBracket.offset);
   }
 
+  /// Visits a list of configurations in an import or export directive.
+  void _visitConfigurations(NodeList<Configuration> configurations) {
+    if (configurations.isEmpty) return;
+
+    builder.startRule();
+
+    for (var configuration in configurations) {
+      split();
+      visit(configuration);
+    }
+
+    builder.endRule();
+  }
+
   /// Visits a "combinator".
   ///
   /// This is a [keyword] followed by a list of [nodes], with specific line
diff --git a/pubspec.lock b/pubspec.lock
index 3dc00b8..c7a51ab 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -4,7 +4,7 @@
   analyzer:
     description: analyzer
     source: hosted
-    version: "0.26.3"
+    version: "0.27.0"
   ansicolor:
     description: ansicolor
     source: hosted
@@ -68,7 +68,7 @@
   http_multi_server:
     description: http_multi_server
     source: hosted
-    version: "1.3.2"
+    version: "2.0.0"
   http_parser:
     description: http_parser
     source: hosted
@@ -96,7 +96,7 @@
   path:
     description: path
     source: hosted
-    version: "1.3.8"
+    version: "1.3.9"
   plugin:
     description: plugin
     source: hosted
@@ -112,7 +112,7 @@
   scheduled_test:
     description: scheduled_test
     source: hosted
-    version: "0.12.4+1"
+    version: "0.12.4+2"
   shelf:
     description: shelf
     source: hosted
@@ -152,7 +152,7 @@
   test:
     description: test
     source: hosted
-    version: "0.12.6"
+    version: "0.12.6+1"
   typed_data:
     description: typed_data
     source: hosted
diff --git a/pubspec.yaml b/pubspec.yaml
index c165eb8..d821eda 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,12 +1,12 @@
 name: dart_style
-version: 0.2.1
+version: 0.2.2
 author: Dart Team <misc@dartlang.org>
 description: Opinionated, automatic Dart source code formatter.
 homepage: https://github.com/dart-lang/dart_style
 environment:
   sdk: ">=1.8.0 <2.0.0"
 dependencies:
-  analyzer: '>=0.25.0 <0.27.0'
+  analyzer: '^0.27.0'
   args: '>=0.12.1 <0.14.0'
   path: '>=1.0.0 <2.0.0'
   source_span: '>=1.1.1 <2.0.0'
diff --git a/test/comments/top_level.unit b/test/comments/top_level.unit
index fbd7326..d1fe80f 100644
--- a/test/comments/top_level.unit
+++ b/test/comments/top_level.unit
@@ -212,4 +212,9 @@
 var a = 1;
 
 /// doc
-var b = 2;
\ No newline at end of file
+var b = 2;
+>>> in dotted name
+import 'a' if (/**/a/**/./**/b/**/) 'c';
+<<<
+import 'a'
+    if (/**/ a /**/ . /**/ b /**/) 'c';
\ No newline at end of file
diff --git a/test/splitting/imports.unit b/test/splitting/imports.unit
index 64a379a..0a0a3df 100644
--- a/test/splitting/imports.unit
+++ b/test/splitting/imports.unit
@@ -120,4 +120,25 @@
 import 'foo.dart'
     hide
         First, //
-        Second;
\ No newline at end of file
+        Second;
+>>> multiple configurations on one line
+import 'a' if (b) 'b' if (c) 'c';
+<<<
+import 'a' if (b) 'b' if (c) 'c';
+>>> if configurations don't fit, they all split
+import 'long/import/url.dart' if (b) 'b' if (c) 'c';
+<<<
+import 'long/import/url.dart'
+    if (b) 'b'
+    if (c) 'c';
+>>> do not split before uri
+import 'long/import/url.dart' if (config) 'very/long/configured/import/url.dart';
+<<<
+import 'long/import/url.dart'
+    if (config) 'very/long/configured/import/url.dart';
+>>> split before ==
+import 'some/uri.dart' if (config.name.debug == 'string') 'c';
+<<<
+import 'some/uri.dart'
+    if (config.name.debug ==
+        'string') 'c';
\ No newline at end of file
diff --git a/test/whitespace/directives.unit b/test/whitespace/directives.unit
index a81dc25..5d7ff38 100644
--- a/test/whitespace/directives.unit
+++ b/test/whitespace/directives.unit
@@ -49,4 +49,12 @@
 >>> no spaces between library identifiers
 library    a .  b   . c;
 <<<
-library a.b.c;
\ No newline at end of file
+library a.b.c;
+>>> configuration
+import'a'if(b  . c . d)'e';
+<<<
+import 'a' if (b.c.d) 'e';
+>>> configuration
+export'a'if(b  . c=='d'   )'e';
+<<<
+export 'a' if (b.c == 'd') 'e';
\ No newline at end of file