Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: lib/src/source_visitor.dart

Issue 1505983005: Upgrade to analyzer 0.27.0. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: More upgrades. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/dart_formatter.dart ('k') | pubspec.lock » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source_visitor.dart
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index a34b36789e70b91f0226e75fd12f41c67e349361..10902b3af1edf4a28301e92cc40929646f82d3ce 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -533,6 +533,26 @@ class SourceVisitor implements AstVisitor {
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 @@ class SourceVisitor implements AstVisitor {
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 @@ class SourceVisitor implements AstVisitor {
space();
visit(node.uri);
+ _visitConfigurations(node.configurations);
+
builder.startRule(new CombinatorRule());
visitNodes(node.combinators);
builder.endRule();
@@ -1062,6 +1095,8 @@ class SourceVisitor implements AstVisitor {
space();
visit(node.uri);
+ _visitConfigurations(node.configurations);
+
if (node.asKeyword != null) {
soloSplit();
token(node.deferredKeyword, after: space);
@@ -1997,6 +2032,20 @@ class SourceVisitor implements AstVisitor {
_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
« no previous file with comments | « lib/src/dart_formatter.dart ('k') | pubspec.lock » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698