OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Functions for working with files and paths. | 5 // Functions for working with files and paths. |
6 | 6 |
7 /** The path to the file currently being written to, relative to [outdir]. */ | 7 /** The path to the file currently being written to, relative to [outdir]. */ |
8 String _filePath; | 8 String _filePath; |
9 | 9 |
10 /** The file currently being written to. */ | 10 /** The file currently being written to. */ |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // TODO(rnystrom): This is a bit hackish. We consider any URL that lacks | 54 // TODO(rnystrom): This is a bit hackish. We consider any URL that lacks |
55 // a scheme to be relative. | 55 // a scheme to be relative. |
56 return const RegExp(@'^\w+:').hasMatch(url); | 56 return const RegExp(@'^\w+:').hasMatch(url); |
57 } | 57 } |
58 | 58 |
59 /** Gets the URL to the documentation for [library]. */ | 59 /** Gets the URL to the documentation for [library]. */ |
60 libraryUrl(Library library) => '${sanitize(library.name)}.html'; | 60 libraryUrl(Library library) => '${sanitize(library.name)}.html'; |
61 | 61 |
62 /** Gets the URL for the documentation for [type]. */ | 62 /** Gets the URL for the documentation for [type]. */ |
63 typeUrl(Type type) { | 63 typeUrl(Type type) { |
| 64 if (type.isTop) return '${sanitize(type.library.name)}.html'; |
64 // Always get the generic type to strip off any type parameters or arguments. | 65 // Always get the generic type to strip off any type parameters or arguments. |
65 // If the type isn't generic, genericType returns `this`, so it works for | 66 // If the type isn't generic, genericType returns `this`, so it works for |
66 // non-generic types too. | 67 // non-generic types too. |
67 return '${sanitize(type.library.name)}/${type.genericType.name}.html'; | 68 return '${sanitize(type.library.name)}/${type.genericType.name}.html'; |
68 } | 69 } |
69 | 70 |
70 /** Gets the URL for the documentation for [member]. */ | 71 /** Gets the URL for the documentation for [member]. */ |
71 memberUrl(Member member) => '${typeUrl(member.declaringType)}#${member.name}'; | 72 memberUrl(Member member) => '${typeUrl(member.declaringType)}#${member.name}'; |
72 | 73 |
73 /** Gets the anchor id for the document for [member]. */ | 74 /** Gets the anchor id for the document for [member]. */ |
74 memberAnchor(Member member) => '${member.name}'; | 75 memberAnchor(Member member) => '${member.name}'; |
OLD | NEW |