| OLD | NEW |
| 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 /// **docgen** is a tool for creating machine readable representations of Dart | 5 /// **docgen** is a tool for creating machine readable representations of Dart |
| 6 /// code metadata, including: classes, members, comments and annotations. | 6 /// code metadata, including: classes, members, comments and annotations. |
| 7 /// | 7 /// |
| 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. | 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. |
| 9 /// | 9 /// |
| 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] | 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 String _packageIntro(packageDir) { | 194 String _packageIntro(packageDir) { |
| 195 var dir = new Directory(packageDir); | 195 var dir = new Directory(packageDir); |
| 196 var files = dir.listSync(); | 196 var files = dir.listSync(); |
| 197 var readmes = files.where((FileSystemEntity each) => (each is File && | 197 var readmes = files.where((FileSystemEntity each) => (each is File && |
| 198 each.path.substring(packageDir.length + 1, each.path.length) | 198 each.path.substring(packageDir.length + 1, each.path.length) |
| 199 .startsWith('README'))).toList(); | 199 .startsWith('README'))).toList(); |
| 200 if (readmes.isEmpty) return ''; | 200 if (readmes.isEmpty) return ''; |
| 201 // If there are multiples, pick the shortest name. | 201 // If there are multiples, pick the shortest name. |
| 202 readmes.sort((a, b) => a.length.compareTo(b.length)); | 202 readmes.sort((a, b) => a.path.length.compareTo(b.path.length)); |
| 203 var readme = readmes.first; | 203 var readme = readmes.first; |
| 204 var linkResolver = (name) => fixReference(name, null, null, null); | 204 var linkResolver = (name) => fixReference(name, null, null, null); |
| 205 var contents = markdown.markdownToHtml(readme | 205 var contents = markdown.markdownToHtml(readme |
| 206 .readAsStringSync(), linkResolver: linkResolver, | 206 .readAsStringSync(), linkResolver: linkResolver, |
| 207 inlineSyntaxes: markdownSyntaxes); | 207 inlineSyntaxes: markdownSyntaxes); |
| 208 return contents; | 208 return contents; |
| 209 } | 209 } |
| 210 | 210 |
| 211 List<Uri> _listLibraries(List<String> args) { | 211 List<Uri> _listLibraries(List<String> args) { |
| 212 var libraries = new List<Uri>(); | 212 var libraries = new List<Uri>(); |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 // with the mixin as an owner private too. | 1149 // with the mixin as an owner private too. |
| 1150 entityMap.values.where((e) => e.owner == qualifiedName).forEach( | 1150 entityMap.values.where((e) => e.owner == qualifiedName).forEach( |
| 1151 (element) => element.isPrivate = true); | 1151 (element) => element.isPrivate = true); |
| 1152 // Move the subclass up to the next public superclass | 1152 // Move the subclass up to the next public superclass |
| 1153 subclasses.forEach((subclass) => addSubclass(subclass)); | 1153 subclasses.forEach((subclass) => addSubclass(subclass)); |
| 1154 } else { | 1154 } else { |
| 1155 // It is an exported item. Loop through each of the exported types, | 1155 // It is an exported item. Loop through each of the exported types, |
| 1156 // and tell them to update their links, given these other exported | 1156 // and tell them to update their links, given these other exported |
| 1157 // names within the library. | 1157 // names within the library. |
| 1158 for (Exported member in library._exportedMembers.values) { | 1158 for (Exported member in library._exportedMembers.values) { |
| 1159 member.updateExports(library._exportedMembers.keys); | 1159 member.updateExports(library._exportedMembers); |
| 1160 } | 1160 } |
| 1161 } | 1161 } |
| 1162 } | 1162 } |
| 1163 } | 1163 } |
| 1164 | 1164 |
| 1165 /// Makes sure that all methods with inherited equivalents have comments. | 1165 /// Makes sure that all methods with inherited equivalents have comments. |
| 1166 void ensureComments() { | 1166 void ensureComments() { |
| 1167 if (_commentsEnsured) return; | 1167 if (_commentsEnsured) return; |
| 1168 _commentsEnsured = true; | 1168 _commentsEnsured = true; |
| 1169 inheritedMethods.forEach((qualifiedName, inheritedMethod) { | 1169 inheritedMethods.forEach((qualifiedName, inheritedMethod) { |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 /// Remove statics from the map of inherited items before adding them. | 1701 /// Remove statics from the map of inherited items before adding them. |
| 1702 Map _filterStatics(Map items) { | 1702 Map _filterStatics(Map items) { |
| 1703 var result = {}; | 1703 var result = {}; |
| 1704 items.forEach((name, item) { | 1704 items.forEach((name, item) { |
| 1705 if (!item.isStatic) { | 1705 if (!item.isStatic) { |
| 1706 result[name] = item; | 1706 result[name] = item; |
| 1707 } | 1707 } |
| 1708 }); | 1708 }); |
| 1709 return result; | 1709 return result; |
| 1710 } | 1710 } |
| OLD | NEW |