| Index: lib/dartdoc/mirrors/mirrors_util.dart
|
| diff --git a/lib/dartdoc/mirrors/mirrors_util.dart b/lib/dartdoc/mirrors/mirrors_util.dart
|
| index 727d5cb6c91759dbbff770346299d526e67c1953..3dad2048d00a980eb488350449601ff9efa76455 100644
|
| --- a/lib/dartdoc/mirrors/mirrors_util.dart
|
| +++ b/lib/dartdoc/mirrors/mirrors_util.dart
|
| @@ -5,6 +5,7 @@
|
| #library('mirrors.util');
|
|
|
| #import('mirrors.dart');
|
| +#import('../../compiler/implementation/util/characters.dart');
|
|
|
| //------------------------------------------------------------------------------
|
| // Utility functions for using the Mirror API
|
| @@ -14,11 +15,10 @@
|
| * Returns an iterable over the type declarations directly inheriting from
|
| * the declaration of this type.
|
| */
|
| -Iterable<InterfaceMirror> computeSubdeclarations(MirrorSystem system,
|
| - InterfaceMirror type) {
|
| +Iterable<InterfaceMirror> computeSubdeclarations(InterfaceMirror type) {
|
| type = type.declaration;
|
| var subtypes = <InterfaceMirror>[];
|
| - system.libraries().forEach((_, library) {
|
| + type.system.libraries().forEach((_, library) {
|
| for (InterfaceMirror otherType in library.types().getValues()) {
|
| var superClass = otherType.superclass();
|
| if (superClass !== null) {
|
| @@ -70,3 +70,32 @@ Mirror findMirror(Map<Object,Mirror> map, String name,
|
| });
|
| return foundMirror;
|
| }
|
| +
|
| +LibraryMirror findLibrary(MemberMirror member) {
|
| + ObjectMirror owner = member.surroundingDeclaration();
|
| + if (owner is LibraryMirror) {
|
| + return owner;
|
| + } else if (owner is TypeMirror) {
|
| + return owner.library();
|
| + }
|
| + throw new Exception('Unexpected owner: ${owner}');
|
| +}
|
| +
|
| +
|
| +/**
|
| + * Returns the column of the start of a location.
|
| + */
|
| +int getLocationColumn(Location location) {
|
| + String text = location.source().text();
|
| + int index = location.start()-1;
|
| + var column = 0;
|
| + while (0 <= index && index < text.length) {
|
| + var charCode = text.charCodeAt(index);
|
| + if (charCode == $CR || charCode == $LF) {
|
| + break;
|
| + }
|
| + index--;
|
| + column++;
|
| + }
|
| + return column;
|
| +}
|
|
|