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

Unified Diff: pkg/dartdoc/lib/dartdoc.dart

Issue 11363031: Named arguments printed correctly by Dartdoc (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dartdoc/lib/dartdoc.dart
diff --git a/pkg/dartdoc/lib/dartdoc.dart b/pkg/dartdoc/lib/dartdoc.dart
index 755b87f9adc3c681ad25bb6197868fddb70ea96f..8c0fc66e2e84dbb8a03eba86460622c023196819 100644
--- a/pkg/dartdoc/lib/dartdoc.dart
+++ b/pkg/dartdoc/lib/dartdoc.dart
@@ -1397,11 +1397,13 @@ class Dartdoc {
write('(');
bool first = true;
bool inOptionals = false;
+ bool isNamed = false;
for (final parameter in parameters) {
if (!first) write(', ');
if (!inOptionals && parameter.isOptional) {
- write('[');
+ isNamed = parameter.isNamed;
+ write(isNamed ? '{' : '[');
inOptionals = true;
}
@@ -1409,14 +1411,16 @@ class Dartdoc {
// Show the default value for named optional parameters.
if (parameter.isOptional && parameter.hasDefaultValue) {
- write(' = ');
+ write(isNamed ? ': ' : ' = ');
write(parameter.defaultValue);
}
first = false;
}
- if (inOptionals) write(']');
+ if (inOptionals) {
+ write(isNamed ? '}' : ']');
+ }
write(')');
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698