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

Unified Diff: lib/src/source_visitor.dart

Issue 2298993002: Handle metadata annotations in parameter lists with trailing commas. (Closed)
Patch Set: Created 4 years, 4 months 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 | « CHANGELOG.md ('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 cb19267087c469c76bb073ed291b51313813dee4..a8e782bc9f0a29d7eeac334636c6ad3c90ae2273 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -2037,6 +2037,8 @@ class SourceVisitor implements AstVisitor {
// Can't have a trailing comma if there are no parameters.
assert(parameters.parameters.isNotEmpty);
+ _metadataRules.add(new MetadataRule());
+
// Always split the parameters.
builder.startRule(new Rule.hard());
@@ -2061,7 +2063,6 @@ class SourceVisitor implements AstVisitor {
builder = builder.startBlock(null);
for (var parameter in parameters.parameters) {
- builder.nestExpression();
visit(parameter);
// The comma after the parameter.
@@ -2077,7 +2078,6 @@ class SourceVisitor implements AstVisitor {
lastRequired = null;
}
- builder.unnest();
newline();
}
@@ -2088,6 +2088,8 @@ class SourceVisitor implements AstVisitor {
builder = builder.endBlock(null, forceSplit: true);
builder.endRule();
+ _metadataRules.removeLast();
+
// Now write the delimiter itself.
_writeText(firstDelimiter.lexeme, firstDelimiter.offset);
if (firstDelimiter != parameters.rightParenthesis) {
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.lock » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698