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 import "dart:collection"; | 7 import "dart:collection"; |
8 | 8 |
9 // These values are allowed to be passed directly over the wire. | 9 // These values are allowed to be passed directly over the wire. |
10 bool _isSimpleValue(var value) { | 10 bool _isSimpleValue(var value) { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 delegate(Invocation invocation) { | 282 delegate(Invocation invocation) { |
283 if (_invokeOnClosure == null) { | 283 if (_invokeOnClosure == null) { |
284 // TODO(ahe): This is a total hack. We're using the mirror | 284 // TODO(ahe): This is a total hack. We're using the mirror |
285 // system to access a private field in a different library. For | 285 // system to access a private field in a different library. For |
286 // some reason, that works. On the other hand, calling a | 286 // some reason, that works. On the other hand, calling a |
287 // private method does not work. | 287 // private method does not work. |
288 | 288 |
289 _LocalInstanceMirrorImpl mirror = | 289 _LocalInstanceMirrorImpl mirror = |
290 reflect(invocation); | 290 reflect(invocation); |
291 _invokeOnClosure = reflectClass(invocation.runtimeType) | 291 _invokeOnClosure = reflectClass(invocation.runtimeType) |
292 .getField(const Symbol('_invokeOnClosure')).reflectee; | 292 .getField(MirrorSystem.getSymbol('_invokeOnClosure', mirror.type.owner
)).reflectee; |
293 } | 293 } |
294 return _invokeOnClosure(reflectee, invocation); | 294 return _invokeOnClosure(reflectee, invocation); |
295 } | 295 } |
296 | 296 |
297 String toString() => 'InstanceMirror on ${Error.safeToString(_reflectee)}'; | 297 String toString() => 'InstanceMirror on ${Error.safeToString(_reflectee)}'; |
298 | 298 |
299 bool operator ==(other) { | 299 bool operator ==(other) { |
300 return other is _LocalInstanceMirrorImpl && | 300 return other is _LocalInstanceMirrorImpl && |
301 identical(_reflectee, other._reflectee); | 301 identical(_reflectee, other._reflectee); |
302 } | 302 } |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 if (typeMirror == null) { | 1321 if (typeMirror == null) { |
1322 typeMirror = makeLocalTypeMirror(key); | 1322 typeMirror = makeLocalTypeMirror(key); |
1323 _instanitationCache[key] = typeMirror; | 1323 _instanitationCache[key] = typeMirror; |
1324 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1324 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
1325 _declarationCache[key] = typeMirror; | 1325 _declarationCache[key] = typeMirror; |
1326 } | 1326 } |
1327 } | 1327 } |
1328 return typeMirror; | 1328 return typeMirror; |
1329 } | 1329 } |
1330 } | 1330 } |
OLD | NEW |