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 import "dart:async" show Future; | 5 import "dart:async" show Future; |
6 import "dart:collection" show UnmodifiableListView, UnmodifiableMapView; | 6 import "dart:collection" show UnmodifiableListView, UnmodifiableMapView; |
7 import "dart:_internal" as internal; | 7 import "dart:_internal" as internal; |
8 | 8 |
9 /** | 9 /** |
10 * Returns a [MirrorSystem] for the current isolate. | 10 * Returns a [MirrorSystem] for the current isolate. |
(...skipping 15 matching lines...) Expand all Loading... |
26 /** | 26 /** |
27 * Returns a [ClassMirror] for the class represented by a Dart | 27 * Returns a [ClassMirror] for the class represented by a Dart |
28 * Type object. | 28 * Type object. |
29 * | 29 * |
30 * This only works with objects local to the current isolate. | 30 * This only works with objects local to the current isolate. |
31 */ | 31 */ |
32 @patch ClassMirror reflectClass(Type key) { | 32 @patch ClassMirror reflectClass(Type key) { |
33 return _Mirrors.reflectClass(key); | 33 return _Mirrors.reflectClass(key); |
34 } | 34 } |
35 | 35 |
36 @patch TypeMirror reflectType(Type key) { | 36 @patch TypeMirror reflectType(Type key, [List<Type> typeArguments]) { |
37 return _Mirrors.reflectType(key); | 37 return _Mirrors.reflectType(key, typeArguments); |
38 } | 38 } |
39 | 39 |
40 @patch class MirrorSystem { | 40 @patch class MirrorSystem { |
41 @patch LibraryMirror findLibrary(Symbol libraryName) { | 41 @patch LibraryMirror findLibrary(Symbol libraryName) { |
42 var candidates = | 42 var candidates = |
43 libraries.values.where((lib) => lib.simpleName == libraryName); | 43 libraries.values.where((lib) => lib.simpleName == libraryName); |
44 if (candidates.length == 1) { | 44 if (candidates.length == 1) { |
45 return candidates.single; | 45 return candidates.single; |
46 } | 46 } |
47 if (candidates.length > 1) { | 47 if (candidates.length > 1) { |
(...skipping 13 matching lines...) Expand all Loading... |
61 ((name.length > 0) && (name[0] == '_') && (library == null))) { | 61 ((name.length > 0) && (name[0] == '_') && (library == null))) { |
62 throw new ArgumentError(library); | 62 throw new ArgumentError(library); |
63 } | 63 } |
64 if (library != null) name = _mangleName(name, library._reflectee); | 64 if (library != null) name = _mangleName(name, library._reflectee); |
65 return new internal.Symbol.unvalidated(name); | 65 return new internal.Symbol.unvalidated(name); |
66 } | 66 } |
67 | 67 |
68 static _mangleName(String name, _MirrorReference lib) | 68 static _mangleName(String name, _MirrorReference lib) |
69 native "Mirrors_mangleName"; | 69 native "Mirrors_mangleName"; |
70 } | 70 } |
OLD | NEW |