| 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 // VM-specific implementation of the dart:mirrors library. | 5 // VM-specific implementation of the dart:mirrors library. |
| 6 | 6 |
| 7 // These values are allowed to be passed directly over the wire. | 7 // These values are allowed to be passed directly over the wire. |
| 8 bool _isSimpleValue(var value) { | 8 bool _isSimpleValue(var value) { |
| 9 return (value == null || value is num || value is String || value is bool); | 9 return (value == null || value is num || value is String || value is bool); |
| 10 } | 10 } |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 | 1113 |
| 1114 // Creates a new local mirror for some Object. | 1114 // Creates a new local mirror for some Object. |
| 1115 static InstanceMirror reflect(Object reflectee) { | 1115 static InstanceMirror reflect(Object reflectee) { |
| 1116 return makeLocalInstanceMirror(reflectee); | 1116 return makeLocalInstanceMirror(reflectee); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 // Creates a new local ClassMirror. | 1119 // Creates a new local ClassMirror. |
| 1120 static ClassMirror makeLocalClassMirror(Type key) | 1120 static ClassMirror makeLocalClassMirror(Type key) |
| 1121 native "Mirrors_makeLocalClassMirror"; | 1121 native "Mirrors_makeLocalClassMirror"; |
| 1122 | 1122 |
| 1123 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); |
| 1123 static ClassMirror reflectClass(Type key) { | 1124 static ClassMirror reflectClass(Type key) { |
| 1124 return makeLocalClassMirror(key); | 1125 var classMirror = _classMirrorCache[key]; |
| 1126 if (classMirror == null) { |
| 1127 classMirror = makeLocalClassMirror(key); |
| 1128 _classMirrorCache[key] = classMirror; |
| 1129 } |
| 1130 return classMirror; |
| 1125 } | 1131 } |
| 1126 } | 1132 } |
| OLD | NEW |