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; | 5 library mirrors; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 | 9 |
10 // TODO(rnystrom): Use "package:" URL (#4968). | 10 // TODO(rnystrom): Use "package:" URL (#4968). |
11 import 'dart2js_mirror.dart'; | 11 import 'dart2js_mirror.dart'; |
12 | 12 |
13 /** | 13 /** |
14 * The main interface for the whole mirror system. | 14 * The main interface for the whole mirror system. |
15 */ | 15 */ |
16 abstract class MirrorSystem { | 16 abstract class MirrorSystem { |
17 /** | 17 /** |
18 * Returns an unmodifiable map of all libraries in this mirror system. | 18 * Returns an unmodifiable map of all libraries in this mirror system. |
19 */ | 19 */ |
20 // TODO(johnniwinther): Change to Map<Uri, LibraryMirror>. | 20 Map<Uri, LibraryMirror> get libraries; |
21 Map<String, LibraryMirror> get libraries; | 21 |
| 22 /** |
| 23 * Returns an iterable of all libraries in the mirror system whose library |
| 24 * name is [libraryName]. |
| 25 */ |
| 26 Iterable<LibraryMirror> findLibrary(String libraryName) { |
| 27 return libraries.values.where( |
| 28 (library) => library.simpleName == libraryName); |
| 29 } |
22 | 30 |
23 /** | 31 /** |
24 * A mirror on the [:dynamic:] type. | 32 * A mirror on the [:dynamic:] type. |
25 */ | 33 */ |
26 TypeMirror get dynamicType; | 34 TypeMirror get dynamicType; |
27 | 35 |
28 /** | 36 /** |
29 * A mirror on the [:void:] type. | 37 * A mirror on the [:void:] type. |
30 */ | 38 */ |
31 TypeMirror get voidType; | 39 TypeMirror get voidType; |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 /** | 699 /** |
692 * Returns the URI where the source originated. | 700 * Returns the URI where the source originated. |
693 */ | 701 */ |
694 Uri get sourceUri; | 702 Uri get sourceUri; |
695 | 703 |
696 /** | 704 /** |
697 * Returns the text of this source. | 705 * Returns the text of this source. |
698 */ | 706 */ |
699 String get sourceText; | 707 String get sourceText; |
700 } | 708 } |
OLD | NEW |