| OLD | NEW | 
|     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 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1854  * underlying data |  1854  * underlying data | 
|  1855  */ |  1855  */ | 
|  1856 class InternalError { |  1856 class InternalError { | 
|  1857   final String message; |  1857   final String message; | 
|  1858   const InternalError(this.message); |  1858   const InternalError(this.message); | 
|  1859   String toString() => "InternalError: '$message'"; |  1859   String toString() => "InternalError: '$message'"; | 
|  1860 } |  1860 } | 
|  1861  |  1861  | 
|  1862 /** |  1862 /** | 
|  1863  * Computes the doc comment for the declaration mirror. |  1863  * Computes the doc comment for the declaration mirror. | 
|  1864 * |  1864  * | 
|  1865  * Multiple comments are concatenated with newlines in between. |  1865  * Multiple comments are concatenated with newlines in between. | 
|  1866  */ |  1866  */ | 
|  1867 String computeComment(DeclarationMirror mirror) { |  1867 String computeComment(DeclarationMirror mirror) { | 
|  1868   String text; |  1868   String text; | 
|  1869   for (InstanceMirror metadata in mirror.metadata) { |  1869   for (InstanceMirror metadata in mirror.metadata) { | 
|  1870     if (metadata is CommentInstanceMirror) { |  1870     if (metadata is CommentInstanceMirror) { | 
|  1871       CommentInstanceMirror comment = metadata; |  1871       CommentInstanceMirror comment = metadata; | 
|  1872       if (comment.isDocComment) { |  1872       if (comment.isDocComment) { | 
|  1873         if (text == null) { |  1873         if (text == null) { | 
|  1874           text = comment.trimmedText; |  1874           text = comment.trimmedText; | 
|  1875         } else { |  1875         } else { | 
|  1876           text = '$text\n${comment.trimmedText}'; |  1876           text = '$text\n${comment.trimmedText}'; | 
|  1877         } |  1877         } | 
|  1878       } |  1878       } | 
|  1879     } |  1879     } | 
|  1880   } |  1880   } | 
|  1881   return text; |  1881   return text; | 
|  1882 } |  1882 } | 
|  1883  |  1883  | 
 |  1884 /** | 
 |  1885  * Computes the doc comment for the declaration mirror as a list. | 
 |  1886  */ | 
 |  1887 List<String> computeUntrimmedCommentAsList(DeclarationMirror mirror) { | 
 |  1888   var text = <String>[]; | 
 |  1889   for (InstanceMirror metadata in mirror.metadata) { | 
 |  1890     if (metadata is CommentInstanceMirror) { | 
 |  1891       CommentInstanceMirror comment = metadata; | 
 |  1892       if (comment.isDocComment) { | 
 |  1893         text.add(comment.text); | 
 |  1894       } | 
 |  1895     } | 
 |  1896   } | 
 |  1897   return text; | 
 |  1898 } | 
 |  1899  | 
|  1884 class DocComment { |  1900 class DocComment { | 
|  1885   final String text; |  1901   final String text; | 
|  1886  |  1902  | 
|  1887   /** |  1903   /** | 
|  1888    * Non-null if the comment is inherited from another declaration. |  1904    * Non-null if the comment is inherited from another declaration. | 
|  1889    */ |  1905    */ | 
|  1890   final ClassMirror inheritedFrom; |  1906   final ClassMirror inheritedFrom; | 
|  1891  |  1907  | 
|  1892   DocComment(this.text, [this.inheritedFrom = null]) { |  1908   DocComment(this.text, [this.inheritedFrom = null]) { | 
|  1893     assert(text != null && !text.trim().isEmpty); |  1909     assert(text != null && !text.trim().isEmpty); | 
|  1894   } |  1910   } | 
|  1895  |  1911  | 
|  1896   String get html => md.markdownToHtml(text); |  1912   String get html => md.markdownToHtml(text); | 
|  1897  |  1913  | 
|  1898   String toString() => text; |  1914   String toString() => text; | 
|  1899 } |  1915 } | 
| OLD | NEW |