| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library docgen.library_helpers; | 5 library docgen.library_helpers; |
| 6 | 6 |
| 7 import 'package:logging/logging.dart'; | 7 import 'package:logging/logging.dart'; |
| 8 import 'package:markdown/markdown.dart' as markdown; | 8 import 'package:markdown/markdown.dart' as markdown; |
| 9 | 9 |
| 10 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/source_mir
rors.dart'; | 10 import 'exports/source_mirrors.dart'; |
| 11 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_ut
il.dart' | 11 import 'exports/mirrors_util.dart' as dart2js_util; |
| 12 as dart2js_util; | |
| 13 | 12 |
| 14 import 'models.dart'; | 13 import 'models/indexable.dart'; |
| 14 import 'models/library.dart'; |
| 15 import 'models/dummy_mirror.dart'; |
| 15 | 16 |
| 16 typedef DeclarationMirror LookupFunction(DeclarationSourceMirror declaration, | 17 typedef DeclarationMirror LookupFunction(DeclarationSourceMirror declaration, |
| 17 String name); | 18 String name); |
| 18 | 19 |
| 19 /// Support for [:foo:]-style code comments to the markdown parser. | 20 /// Support for [:foo:]-style code comments to the markdown parser. |
| 20 final List<markdown.InlineSyntax> MARKDOWN_SYNTAXES = | 21 final List<markdown.InlineSyntax> MARKDOWN_SYNTAXES = |
| 21 [new markdown.CodeSyntax(r'\[:\s?((?:.|\n)*?)\s?:\]')]; | 22 [new markdown.CodeSyntax(r'\[:\s?((?:.|\n)*?)\s?:\]')]; |
| 22 | 23 |
| 23 bool get includePrivateMembers { | 24 bool get includePrivateMembers { |
| 24 if (_includePrivate == null) { | 25 if (_includePrivate == null) { |
| 25 throw new StateError('includePrivate has not been set'); | 26 throw new StateError('includePrivate has not been set'); |
| 26 } | 27 } |
| 27 return _includePrivate; | 28 return _includePrivate; |
| 28 } | 29 } |
| 29 | 30 |
| 30 void set includePrivateMembers(bool value) { | 31 void set includePrivateMembers(bool value) { |
| 31 if (_includePrivate != null) { | 32 if (_includePrivate != null) { |
| 32 throw new StateError('includePrivate has already been set'); | 33 throw new StateError('includePrivate has already been set'); |
| 33 } | 34 } |
| 34 if (value == null) throw new ArgumentError('includePrivate cannot be null'); | 35 if (value == null) throw new ArgumentError('includePrivate cannot be null'); |
| 35 _includePrivate = value; | 36 _includePrivate = value; |
| 36 } | 37 } |
| 37 | 38 |
| 38 bool _includePrivate; | 39 bool _includePrivate; |
| 39 | 40 |
| 40 /// Return true if this item and all of its owners are all visible. | 41 /// Return true if this item and all of its owners are all visible. |
| 41 bool isFullChainVisible(Indexable item) { | 42 bool isFullChainVisible(Indexable item) { |
| 42 return includePrivateMembers || (!item.isPrivate && (item.owner != null ? | 43 return includePrivateMembers || (!item.isPrivate && (item.owner != null ? |
| 43 isFullChainVisible(item.owner) : true)); | 44 isFullChainVisible(item.owner) : true)); |
| 44 } | 45 } |
| 45 | 46 |
| 46 /// Logger for printing out progress of documentation generation. | 47 /// Logger for printing out progress of documentation generation. |
| 47 final Logger logger = new Logger('Docgen'); | 48 final Logger logger = new Logger('Docgen'); |
| 48 | 49 |
| 49 /// The dart:core library, which contains all types that are always available | 50 /// The dart:core library, which contains all types that are always available |
| 50 /// without import. | 51 /// without import. |
| 51 Library _coreLibrary; | 52 Library _coreLibrary; |
| 52 | 53 |
| 53 /// Set of libraries declared in the SDK, so libraries that can be accessed | 54 /// Set of libraries declared in the SDK, so libraries that can be accessed |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 append = true; | 225 append = true; |
| 225 } | 226 } |
| 226 index++; | 227 index++; |
| 227 } | 228 } |
| 228 } | 229 } |
| 229 return tokens; | 230 return tokens; |
| 230 } | 231 } |
| 231 | 232 |
| 232 // HTML escaped version of '<' character. | 233 // HTML escaped version of '<' character. |
| 233 const _LESS_THAN = '<'; | 234 const _LESS_THAN = '<'; |
| OLD | NEW |