OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // For the purposes of the mirrors library, we adopt a naming | 5 // For the purposes of the mirrors library, we adopt a naming |
6 // convention with respect to getters and setters. Specifically, for | 6 // convention with respect to getters and setters. Specifically, for |
7 // some variable or field... | 7 // some variable or field... |
8 // | 8 // |
9 // var myField; | 9 // var myField; |
10 // | 10 // |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 * Returns an immutable map from URIs to mirrors for all | 72 * Returns an immutable map from URIs to mirrors for all |
73 * libraries known to this mirror system. | 73 * libraries known to this mirror system. |
74 */ | 74 */ |
75 Map<Uri, LibraryMirror> get libraries; | 75 Map<Uri, LibraryMirror> get libraries; |
76 | 76 |
77 /** | 77 /** |
78 * Returns the unique library named [libraryName] if it exists. | 78 * Returns the unique library named [libraryName] if it exists. |
79 * | 79 * |
80 * If no unique library exists, an error is thrown. | 80 * If no unique library exists, an error is thrown. |
81 */ | 81 */ |
82 LibraryMirror findLibrary(Symbol libraryName); | 82 LibraryMirror findLibrary(Symbol libraryName) { |
| 83 return libraries.values.singleWhere( |
| 84 (library) => library.simpleName == libraryName); |
| 85 } |
83 | 86 |
84 /** | 87 /** |
85 * A mirror on the isolate associated with this [MirrorSystem]. | 88 * A mirror on the isolate associated with this [MirrorSystem]. |
86 * This may be null if this mirror system is not running. | 89 * This may be null if this mirror system is not running. |
87 */ | 90 */ |
88 IsolateMirror get isolate; | 91 IsolateMirror get isolate; |
89 | 92 |
90 /** | 93 /** |
91 * A mirror on the [:dynamic:] type. | 94 * A mirror on the [:dynamic:] type. |
92 */ | 95 */ |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 * | 1219 * |
1217 * When used as metadata on an import of "dart:mirrors", this metadata does | 1220 * When used as metadata on an import of "dart:mirrors", this metadata does |
1218 * not apply to the library in which the annotation is used, but instead | 1221 * not apply to the library in which the annotation is used, but instead |
1219 * applies to the other libraries (all libraries if "*" is used). | 1222 * applies to the other libraries (all libraries if "*" is used). |
1220 */ | 1223 */ |
1221 final override; | 1224 final override; |
1222 | 1225 |
1223 const MirrorsUsed( | 1226 const MirrorsUsed( |
1224 {this.symbols, this.targets, this.metaTargets, this.override}); | 1227 {this.symbols, this.targets, this.metaTargets, this.override}); |
1225 } | 1228 } |
OLD | NEW |