OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 mirrors_util; | 5 library mirrors_util; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 // TODO(rnystrom): Use "package:" URL (#4968). | 9 // TODO(rnystrom): Use "package:" URL (#4968). |
10 import 'mirrors.dart'; | 10 import 'mirrors.dart'; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 LibraryMirror findLibrary(MemberMirror member) { | 48 LibraryMirror findLibrary(MemberMirror member) { |
49 DeclarationMirror owner = member.owner; | 49 DeclarationMirror owner = member.owner; |
50 if (owner is LibraryMirror) { | 50 if (owner is LibraryMirror) { |
51 return owner; | 51 return owner; |
52 } else if (owner is TypeMirror) { | 52 } else if (owner is TypeMirror) { |
53 return owner.library; | 53 return owner.library; |
54 } | 54 } |
55 throw new Exception('Unexpected owner: ${owner}'); | 55 throw new Exception('Unexpected owner: ${owner}'); |
56 } | 56 } |
57 | 57 |
58 class HierarchyIterable extends Iterable<ClassMirror> { | 58 class HierarchyIterable extends IterableBase<ClassMirror> { |
59 final bool includeType; | 59 final bool includeType; |
60 final ClassMirror type; | 60 final ClassMirror type; |
61 | 61 |
62 HierarchyIterable(this.type, {bool includeType}) | 62 HierarchyIterable(this.type, {bool includeType}) |
63 : this.includeType = includeType; | 63 : this.includeType = includeType; |
64 | 64 |
65 Iterator<ClassMirror> get iterator => | 65 Iterator<ClassMirror> get iterator => |
66 new HierarchyIterator(type, includeType: includeType); | 66 new HierarchyIterator(type, includeType: includeType); |
67 } | 67 } |
68 | 68 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // * Foo | 152 // * Foo |
153 // */ | 153 // */ |
154 // as "\nFoo\n" and not as "\nFoo\n ". | 154 // as "\nFoo\n" and not as "\nFoo\n ". |
155 sb.write(line); | 155 sb.write(line); |
156 } | 156 } |
157 } | 157 } |
158 return sb.toString(); | 158 return sb.toString(); |
159 } | 159 } |
160 throw new ArgumentError('Invalid comment $comment'); | 160 throw new ArgumentError('Invalid comment $comment'); |
161 } | 161 } |
OLD | NEW |