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

Side by Side Diff: dart/sdk/lib/_internal/dartdoc/lib/dartdoc.dart

Issue 64033002: Version 0.8.10.8 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 writeln('</p>'); 1179 writeln('</p>');
1180 } 1180 }
1181 1181
1182 final subtypes = []; 1182 final subtypes = [];
1183 for (final subtype in computeSubdeclarations(type)) { 1183 for (final subtype in computeSubdeclarations(type)) {
1184 subtypes.add(subtype); 1184 subtypes.add(subtype);
1185 } 1185 }
1186 subtypes.sort((x, y) => x.simpleName.compareTo(y.simpleName)); 1186 subtypes.sort((x, y) => x.simpleName.compareTo(y.simpleName));
1187 1187
1188 // Show the chain of superclasses. 1188 // Show the chain of superclasses.
1189 if (!type.superclass.isObject) { 1189 var superclass = getSuperclass(type);
1190 if (!superclass.isObject) {
1190 final supertypes = []; 1191 final supertypes = [];
1191 var thisType = type.superclass; 1192 var thisType = superclass;
1192 do { 1193 do {
1193 supertypes.add(thisType); 1194 supertypes.add(thisType);
1194 thisType = thisType.superclass; 1195 thisType = getSuperclass(thisType);
1195 } while (!thisType.isObject); 1196 } while (!thisType.isObject);
1196 1197
1197 writeln('<h3>Extends</h3>'); 1198 writeln('<h3>Extends</h3>');
1198 writeln('<p>'); 1199 writeln('<p>');
1199 for (var i = supertypes.length - 1; i >= 0; i--) { 1200 for (var i = supertypes.length - 1; i >= 0; i--) {
1200 typeSpan(supertypes[i]); 1201 typeSpan(supertypes[i]);
1201 write('&nbsp;&gt;&nbsp;'); 1202 write('&nbsp;&gt;&nbsp;');
1202 } 1203 }
1203 1204
1204 // Write this class. 1205 // Write this class.
1205 typeSpan(type); 1206 typeSpan(type);
1206 writeln('</p>'); 1207 writeln('</p>');
1207 } 1208 }
1208 1209
1209 listTypes(subtypes, 'Subclasses'); 1210 listTypes(subtypes, 'Subclasses');
1210 listTypes(type.superinterfaces, 'Implements'); 1211 listTypes(getAppliedMixins(type), 'Mixins');
1212 listTypes(getExplicitInterfaces(type), 'Implements');
1211 } 1213 }
1212 1214
1213 /** 1215 /**
1214 * Documents the definition of [type] if it is a typedef. 1216 * Documents the definition of [type] if it is a typedef.
1215 */ 1217 */
1216 void docTypedef(TypeMirror type) { 1218 void docTypedef(TypeMirror type) {
1217 if (type is! TypedefMirror) { 1219 if (type is! TypedefMirror) {
1218 return; 1220 return;
1219 } 1221 }
1220 writeln('<div class="method"><h4 id="${type.simpleName}">'); 1222 writeln('<div class="method"><h4 id="${type.simpleName}">');
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 write(' value)'); 1567 write(' value)');
1566 } 1568 }
1567 } 1569 }
1568 1570
1569 var prefix = host is LibraryMirror ? '' : '${typeName(host)}.'; 1571 var prefix = host is LibraryMirror ? '' : '${typeName(host)}.';
1570 write(''' <a class="anchor-link" href="#${memberAnchor(member)}" 1572 write(''' <a class="anchor-link" href="#${memberAnchor(member)}"
1571 title="Permalink to $prefix$name">#</a>'''); 1573 title="Permalink to $prefix$name">#</a>''');
1572 writeln('</h4>'); 1574 writeln('</h4>');
1573 1575
1574 if (inherited) { 1576 if (inherited) {
1575 write('<div class="inherited-from">inherited from '); 1577 docInherited(host, member.owner);
1576 annotateType(host, member.owner);
1577 write('</div>');
1578 } 1578 }
1579 1579
1580 writeln('<div class="doc">'); 1580 writeln('<div class="doc">');
1581 docComment(host, getMemberComment(member)); 1581 docComment(host, getMemberComment(member));
1582 if (showCode) { 1582 if (showCode) {
1583 docCode(member.location); 1583 docCode(member.location);
1584 } 1584 }
1585 writeln('</div>'); 1585 writeln('</div>');
1586 1586
1587 writeln('</div>'); 1587 writeln('</div>');
1588 1588
1589 _currentMember = null; 1589 _currentMember = null;
1590 } 1590 }
1591 1591
1592 /**
1593 * Annotate a member as inherited or mixed in from [owner].
1594 */
1595 void docInherited(ContainerMirror host, ClassMirror owner) {
1596 if (isMixinApplication(owner)) {
1597 write('<div class="inherited-from">mixed in from ');
1598 annotateType(host, owner.mixin);
1599 write('</div>');
1600 } else {
1601 write('<div class="inherited-from">inherited from ');
1602 annotateType(host, owner);
1603 write('</div>');
1604 }
1605 }
1606
1592 void docField(ContainerMirror host, VariableMirror field, 1607 void docField(ContainerMirror host, VariableMirror field,
1593 {bool asGetter: false, bool asSetter: false}) { 1608 {bool asGetter: false, bool asSetter: false}) {
1594 if (asGetter) { 1609 if (asGetter) {
1595 docMethod(host, field, asGetter: true); 1610 docMethod(host, field, asGetter: true);
1596 } else if (asSetter) { 1611 } else if (asSetter) {
1597 docMethod(host, field, asGetter: false); 1612 docMethod(host, field, asGetter: false);
1598 } else { 1613 } else {
1599 docProperty(host, field, null); 1614 docProperty(host, field, null);
1600 } 1615 }
1601 } 1616 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 var prefix = host is LibraryMirror ? '' : '${typeName(host)}.'; 1662 var prefix = host is LibraryMirror ? '' : '${typeName(host)}.';
1648 write( 1663 write(
1649 ''' 1664 '''
1650 <strong>${getter.simpleName}</strong> <a class="anchor-link" 1665 <strong>${getter.simpleName}</strong> <a class="anchor-link"
1651 href="#${memberAnchor(getter)}" 1666 href="#${memberAnchor(getter)}"
1652 title="Permalink to $prefix${getter.simpleName}">#</a> 1667 title="Permalink to $prefix${getter.simpleName}">#</a>
1653 </h4> 1668 </h4>
1654 '''); 1669 ''');
1655 1670
1656 if (inherited) { 1671 if (inherited) {
1657 write('<div class="inherited-from">inherited from '); 1672 docInherited(host, getter.owner);
1658 annotateType(host, getter.owner);
1659 write('</div>');
1660 } 1673 }
1661 1674
1662 DocComment comment = getMemberComment(getter); 1675 DocComment comment = getMemberComment(getter);
1663 if (comment == null && setter != null) { 1676 if (comment == null && setter != null) {
1664 comment = getMemberComment(setter); 1677 comment = getMemberComment(setter);
1665 } 1678 }
1666 writeln('<div class="doc">'); 1679 writeln('<div class="doc">');
1667 docComment(host, comment); 1680 docComment(host, comment);
1668 docCode(getter.location); 1681 docCode(getter.location);
1669 if (setter != null) { 1682 if (setter != null) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 comment = computeComment(inheritedMember); 1785 comment = computeComment(inheritedMember);
1773 if (comment != null) { 1786 if (comment != null) {
1774 inheritedFrom = type; 1787 inheritedFrom = type;
1775 break; 1788 break;
1776 } 1789 }
1777 } 1790 }
1778 } 1791 }
1779 } 1792 }
1780 } 1793 }
1781 if (comment == null) return null; 1794 if (comment == null) return null;
1795 if (isMixinApplication(inheritedFrom)) {
1796 inheritedFrom = inheritedFrom.mixin;
1797 }
1782 return new DocComment(comment, inheritedFrom, dartdocSyntaxes, 1798 return new DocComment(comment, inheritedFrom, dartdocSyntaxes,
1783 dartdocResolver); 1799 dartdocResolver);
1784 } 1800 }
1785 1801
1786 /** 1802 /**
1787 * Converts [fullPath] which is understood to be a full path from the root of 1803 * Converts [fullPath] which is understood to be a full path from the root of
1788 * the generated docs to one relative to the current file. 1804 * the generated docs to one relative to the current file.
1789 */ 1805 */
1790 String relativePath(String fullPath) { 1806 String relativePath(String fullPath) {
1791 // Don't make it relative if it's an absolute path. 1807 // Don't make it relative if it's an absolute path.
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 return ''' 2330 return '''
2315 <div class="mdn"> 2331 <div class="mdn">
2316 $mdnComment 2332 $mdnComment
2317 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> 2333 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div>
2318 </div> 2334 </div>
2319 '''; 2335 ''';
2320 } 2336 }
2321 2337
2322 String toString() => mdnComment; 2338 String toString() => mdnComment;
2323 } 2339 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | dart/sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698