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 |