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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (type.isTop) return '${sanitize(type.library.name)}.html'; |
65 // 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. |
66 // 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 |
67 // non-generic types too. | 67 // non-generic types too. |
68 return '${sanitize(type.library.name)}/${type.genericType.name}.html'; | 68 return '${sanitize(type.library.name)}/${type.genericType.name}.html'; |
69 } | 69 } |
70 | 70 |
71 /** Gets the URL for the documentation for [member]. */ | 71 /** Gets the URL for the documentation for [member]. */ |
72 memberUrl(Member member) => '${typeUrl(member.declaringType)}#${member.name}'; | 72 memberUrl(Member member) { |
| 73 final typeUrl = typeUrl(member.declaringType); |
| 74 if (!member.isConstructor) return '$typeUrl#${member.name}'; |
| 75 if (member.constructorName == '') return '$typeUrl#new:${member.name}'; |
| 76 return '$typeUrl#new:${member.name}.${member.constructorName}'; |
| 77 } |
73 | 78 |
74 /** Gets the anchor id for the document for [member]. */ | 79 /** Gets the anchor id for the document for [member]. */ |
75 memberAnchor(Member member) => '${member.name}'; | 80 memberAnchor(Member member) => '${member.name}'; |
OLD | NEW |