| 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 // TODO(rnystrom): Use "package:" URL (#4968). | 7 // TODO(rnystrom): Use "package:" URL (#4968). |
| 8 import 'mirrors.dart'; | 8 import 'mirrors.dart'; |
| 9 | 9 |
| 10 //------------------------------------------------------------------------------ | 10 //------------------------------------------------------------------------------ |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 LibraryMirror findLibrary(MemberMirror member) { | 46 LibraryMirror findLibrary(MemberMirror member) { |
| 47 DeclarationMirror owner = member.owner; | 47 DeclarationMirror owner = member.owner; |
| 48 if (owner is LibraryMirror) { | 48 if (owner is LibraryMirror) { |
| 49 return owner; | 49 return owner; |
| 50 } else if (owner is TypeMirror) { | 50 } else if (owner is TypeMirror) { |
| 51 return owner.library; | 51 return owner.library; |
| 52 } | 52 } |
| 53 throw new Exception('Unexpected owner: ${owner}'); | 53 throw new Exception('Unexpected owner: ${owner}'); |
| 54 } | 54 } |
| 55 | 55 |
| 56 class HierarchyIterable implements Iterable<ClassMirror> { | 56 class HierarchyIterable extends Iterable<ClassMirror> { |
| 57 final bool includeType; | 57 final bool includeType; |
| 58 final ClassMirror type; | 58 final ClassMirror type; |
| 59 | 59 |
| 60 HierarchyIterable(this.type, {bool includeType}) | 60 HierarchyIterable(this.type, {bool includeType}) |
| 61 : this.includeType = includeType; | 61 : this.includeType = includeType; |
| 62 | 62 |
| 63 Iterator<ClassMirror> iterator() => | 63 Iterator<ClassMirror> iterator() => |
| 64 new HierarchyIterator(type, includeType: includeType); | 64 new HierarchyIterator(type, includeType: includeType); |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 type = object; | 106 type = object; |
| 107 object = null; | 107 object = null; |
| 108 return type; | 108 return type; |
| 109 } else { | 109 } else { |
| 110 return push(queue.removeFirst()); | 110 return push(queue.removeFirst()); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool get hasNext => !queue.isEmpty || object != null; | 114 bool get hasNext => !queue.isEmpty || object != null; |
| 115 } | 115 } |
| OLD | NEW |