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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 return _invokeOnClosure(reflectee, invocation); | 276 return _invokeOnClosure(reflectee, invocation); |
277 } | 277 } |
278 | 278 |
279 String toString() => 'InstanceMirror on ${Error.safeToString(_reflectee)}'; | 279 String toString() => 'InstanceMirror on ${Error.safeToString(_reflectee)}'; |
280 | 280 |
281 bool operator ==(other) { | 281 bool operator ==(other) { |
282 return other is _LocalInstanceMirrorImpl && | 282 return other is _LocalInstanceMirrorImpl && |
283 identical(_reflectee, other._reflectee); | 283 identical(_reflectee, other._reflectee); |
284 } | 284 } |
285 | 285 |
| 286 // TODO(12909): Use the reflectee's identity hash. |
286 int get hashCode => _reflectee.hashCode; | 287 int get hashCode => _reflectee.hashCode; |
287 | 288 |
288 _invoke(reflectee, functionName, positionalArguments) | 289 _invoke(reflectee, functionName, positionalArguments) |
289 native 'InstanceMirror_invoke'; | 290 native 'InstanceMirror_invoke'; |
290 | 291 |
291 _invokeGetter(reflectee, getterName) | 292 _invokeGetter(reflectee, getterName) |
292 native 'InstanceMirror_invokeGetter'; | 293 native 'InstanceMirror_invokeGetter'; |
293 | 294 |
294 _invokeSetter(reflectee, setterName, value) | 295 _invokeSetter(reflectee, setterName, value) |
295 native 'InstanceMirror_invokeSetter'; | 296 native 'InstanceMirror_invokeSetter'; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 | 623 |
623 List<InstanceMirror> get metadata { | 624 List<InstanceMirror> get metadata { |
624 // Get the metadata objects, convert them into InstanceMirrors using | 625 // Get the metadata objects, convert them into InstanceMirrors using |
625 // reflect() and then make them into a Dart list. | 626 // reflect() and then make them into a Dart list. |
626 return _metadata(_reflectee).map(reflect).toList(growable:false); | 627 return _metadata(_reflectee).map(reflect).toList(growable:false); |
627 } | 628 } |
628 | 629 |
629 bool operator ==(other) { | 630 bool operator ==(other) { |
630 return this.runtimeType == other.runtimeType && | 631 return this.runtimeType == other.runtimeType && |
631 this._reflectee == other._reflectee && | 632 this._reflectee == other._reflectee && |
632 (isOriginalDeclaration || | 633 this._reflectedType == other._reflectedType; |
633 this._reflectedType == other._reflectedType); | |
634 } | 634 } |
635 | 635 |
636 int get hashCode => simpleName.hashCode; | 636 int get hashCode => simpleName.hashCode; |
637 | 637 |
638 static _name(reflectee) | 638 static _name(reflectee) |
639 native "ClassMirror_name"; | 639 native "ClassMirror_name"; |
640 | 640 |
641 static _library(reflectee) | 641 static _library(reflectee) |
642 native "ClassMirror_library"; | 642 native "ClassMirror_library"; |
643 | 643 |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 if (typeMirror == null) { | 1295 if (typeMirror == null) { |
1296 typeMirror = makeLocalTypeMirror(key); | 1296 typeMirror = makeLocalTypeMirror(key); |
1297 _instanitationCache[key] = typeMirror; | 1297 _instanitationCache[key] = typeMirror; |
1298 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1298 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
1299 _declarationCache[key] = typeMirror; | 1299 _declarationCache[key] = typeMirror; |
1300 } | 1300 } |
1301 } | 1301 } |
1302 return typeMirror; | 1302 return typeMirror; |
1303 } | 1303 } |
1304 } | 1304 } |
OLD | NEW |