In the navigation, list exception types after other types.

Review URL: http://codereview.chromium.org//8885005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2223 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
rnystrom@google.com 2011-12-08 03:31:41 +00:00
parent 58fea99105
commit 430a969207

View file

@ -248,29 +248,39 @@ docNavigation() {
/** Writes the navigation for the types contained by the given library. */
docLibraryNavigation(Library library) {
final types = orderByName(library.types).filter(
(type) => !type.isTop && !type.name.startsWith('_'));
// Show the exception types separately.
final types = <Type>[];
final exceptions = <Type>[];
if (types.length == 0) return;
for (final type in orderByName(library.types)) {
if (type.isTop) continue;
if (type.name.startsWith('_')) continue;
writeln('<ul>');
for (final type in types) {
var icon = 'icon-interface';
if (type.name.endsWith('Exception')) {
icon = 'icon-exception';
} else if (type.isClass) {
icon = 'icon-class';
}
write('<li>');
if (_currentType == type) {
write('<div class="$icon"></div><strong>${typeName(type)}</strong>');
exceptions.add(type);
} else {
write(a(typeUrl(type), '<div class="$icon"></div>${typeName(type)}'));
types.add(type);
}
}
if ((types.length == 0) && (exceptions.length == 0)) return;
writeType(String icon, Type type) {
write('<li>');
if (_currentType == type) {
write(
'<div class="icon-$icon"></div><strong>${typeName(type)}</strong>');
} else {
write(a(typeUrl(type),
'<div class="icon-$icon"></div>${typeName(type)}'));
}
writeln('</li>');
}
writeln('<ul>');
types.forEach((type) => writeType(type.isClass ? 'class' : 'interface',
type));
exceptions.forEach((type) => writeType('exception', type));
writeln('</ul>');
}