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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * To generate docs for a library, run this script with the path to an 6 * To generate docs for a library, run this script with the path to an
7 * entrypoint .dart file, like: 7 * entrypoint .dart file, like:
8 * 8 *
9 * $ dart dartdoc.dart foo.dart 9 * $ dart dartdoc.dart foo.dart
10 * 10 *
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 writeln('</div>'); 1390 writeln('</div>');
1391 1391
1392 writeln('</div>'); 1392 writeln('</div>');
1393 } 1393 }
1394 1394
1395 void docParamList(ContainerMirror enclosingType, 1395 void docParamList(ContainerMirror enclosingType,
1396 List<ParameterMirror> parameters) { 1396 List<ParameterMirror> parameters) {
1397 write('('); 1397 write('(');
1398 bool first = true; 1398 bool first = true;
1399 bool inOptionals = false; 1399 bool inOptionals = false;
1400 bool isNamed = false;
1400 for (final parameter in parameters) { 1401 for (final parameter in parameters) {
1401 if (!first) write(', '); 1402 if (!first) write(', ');
1402 1403
1403 if (!inOptionals && parameter.isOptional) { 1404 if (!inOptionals && parameter.isOptional) {
1404 write('['); 1405 isNamed = parameter.isNamed;
1406 write(isNamed ? '{' : '[');
1405 inOptionals = true; 1407 inOptionals = true;
1406 } 1408 }
1407 1409
1408 annotateType(enclosingType, parameter.type, parameter.simpleName); 1410 annotateType(enclosingType, parameter.type, parameter.simpleName);
1409 1411
1410 // Show the default value for named optional parameters. 1412 // Show the default value for named optional parameters.
1411 if (parameter.isOptional && parameter.hasDefaultValue) { 1413 if (parameter.isOptional && parameter.hasDefaultValue) {
1412 write(' = '); 1414 write(isNamed ? ': ' : ' = ');
1413 write(parameter.defaultValue); 1415 write(parameter.defaultValue);
1414 } 1416 }
1415 1417
1416 first = false; 1418 first = false;
1417 } 1419 }
1418 1420
1419 if (inOptionals) write(']'); 1421 if (inOptionals) {
1422 write(isNamed ? '}' : ']');
1423 }
1420 write(')'); 1424 write(')');
1421 } 1425 }
1422 1426
1423 void docComment(ContainerMirror host, DocComment comment) { 1427 void docComment(ContainerMirror host, DocComment comment) {
1424 if (comment != null) { 1428 if (comment != null) {
1425 if (comment.inheritedFrom != null) { 1429 if (comment.inheritedFrom != null) {
1426 writeln('<div class="inherited">'); 1430 writeln('<div class="inherited">');
1427 writeln(comment.html); 1431 writeln(comment.html);
1428 write('<div class="docs-inherited-from">docs inherited from '); 1432 write('<div class="docs-inherited-from">docs inherited from ');
1429 annotateType(host, comment.inheritedFrom); 1433 annotateType(host, comment.inheritedFrom);
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 final ClassMirror inheritedFrom; 1860 final ClassMirror inheritedFrom;
1857 1861
1858 DocComment(this.text, [this.inheritedFrom = null]) { 1862 DocComment(this.text, [this.inheritedFrom = null]) {
1859 assert(text != null && !text.trim().isEmpty); 1863 assert(text != null && !text.trim().isEmpty);
1860 } 1864 }
1861 1865
1862 String get html => md.markdownToHtml(text); 1866 String get html => md.markdownToHtml(text);
1863 1867
1864 String toString() => text; 1868 String toString() => text;
1865 } 1869 }
OLDNEW
« 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