| 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:nativewrappers"; | 5 import "dart:nativewrappers"; |
| 6 // TODO(ahe): Move _symbol_dev.Symbol to its own "private" library? | 6 // TODO(ahe): Move _symbol_dev.Symbol to its own "private" library? |
| 7 import "dart:_collection-dev" as _symbol_dev; | 7 import "dart:_collection-dev" as _symbol_dev; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Returns a [MirrorSystem] for the current isolate. | 10 * Returns a [MirrorSystem] for the current isolate. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 /** | 34 /** |
| 35 * Returns a [ClassMirror] for the class represented by a Dart | 35 * Returns a [ClassMirror] for the class represented by a Dart |
| 36 * Type object. | 36 * Type object. |
| 37 * | 37 * |
| 38 * This only works with objects local to the current isolate. | 38 * This only works with objects local to the current isolate. |
| 39 */ | 39 */ |
| 40 patch ClassMirror reflectClass(Type key) { | 40 patch ClassMirror reflectClass(Type key) { |
| 41 return _Mirrors.reflectClass(key); | 41 return _Mirrors.reflectClass(key); |
| 42 } | 42 } |
| 43 | 43 |
| 44 patch TypeMirror reflectType(Type key) { |
| 45 return _Mirrors.reflectType(key); |
| 46 } |
| 47 |
| 44 patch class MirrorSystem { | 48 patch class MirrorSystem { |
| 45 /* patch */ static String getName(Symbol symbol) { | 49 /* patch */ static String getName(Symbol symbol) { |
| 46 String string = _symbol_dev.Symbol.getName(symbol); | 50 String string = _symbol_dev.Symbol.getName(symbol); |
| 47 if (string.contains(' with ')) return string; | 51 if (string.contains(' with ')) return string; |
| 48 return _unmangleName(string); | 52 return _unmangleName(string); |
| 49 } | 53 } |
| 50 /* patch */ static Symbol getSymbol(String name, [LibraryMirror library]) { | 54 /* patch */ static Symbol getSymbol(String name, [LibraryMirror library]) { |
| 51 if (library is! LibraryMirror || | 55 if (library is! LibraryMirror || |
| 52 ((name[0] == '_') && (library == null))) { | 56 ((name[0] == '_') && (library == null))) { |
| 53 throw new ArgumentError(library); | 57 throw new ArgumentError(library); |
| 54 } | 58 } |
| 55 if (library != null) name = _mangleName(name, library._reflectee); | 59 if (library != null) name = _mangleName(name, library._reflectee); |
| 56 return new _symbol_dev.Symbol.unvalidated(name); | 60 return new _symbol_dev.Symbol.unvalidated(name); |
| 57 } | 61 } |
| 58 | 62 |
| 59 static _unmangleName(String name) | 63 static _unmangleName(String name) |
| 60 native "Mirrors_unmangleName"; | 64 native "Mirrors_unmangleName"; |
| 61 static _mangleName(String name, _MirrorReference lib) | 65 static _mangleName(String name, _MirrorReference lib) |
| 62 native "Mirrors_mangleName"; | 66 native "Mirrors_mangleName"; |
| 63 } | 67 } |
| OLD | NEW |