Chromium Code Reviews| 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(rmacnak): Use the reflectee's identity hash. | |
|
siva
2013/08/28 23:12:06
Please open an issue for this and use the issue nu
| |
| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 | 578 |
| 578 List<InstanceMirror> get metadata { | 579 List<InstanceMirror> get metadata { |
| 579 // Get the metadata objects, convert them into InstanceMirrors using | 580 // Get the metadata objects, convert them into InstanceMirrors using |
| 580 // reflect() and then make them into a Dart list. | 581 // reflect() and then make them into a Dart list. |
| 581 return _metadata(_reflectee).map(reflect).toList(growable:false); | 582 return _metadata(_reflectee).map(reflect).toList(growable:false); |
| 582 } | 583 } |
| 583 | 584 |
| 584 bool operator ==(other) { | 585 bool operator ==(other) { |
| 585 return this.runtimeType == other.runtimeType && | 586 return this.runtimeType == other.runtimeType && |
| 586 this._reflectee == other._reflectee && | 587 this._reflectee == other._reflectee && |
| 587 (isOriginalDeclaration || | 588 this._reflectedType == other._reflectedType; |
| 588 this._reflectedType == other._reflectedType); | |
| 589 } | 589 } |
| 590 | 590 |
| 591 int get hashCode => simpleName.hashCode; | 591 int get hashCode => simpleName.hashCode; |
| 592 | 592 |
| 593 static _name(reflectee) | 593 static _name(reflectee) |
| 594 native "ClassMirror_name"; | 594 native "ClassMirror_name"; |
| 595 | 595 |
| 596 static _library(reflectee) | 596 static _library(reflectee) |
| 597 native "ClassMirror_library"; | 597 native "ClassMirror_library"; |
| 598 | 598 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1237 if (typeMirror == null) { | 1237 if (typeMirror == null) { |
| 1238 typeMirror = makeLocalTypeMirror(key); | 1238 typeMirror = makeLocalTypeMirror(key); |
| 1239 _instanitationCache[key] = typeMirror; | 1239 _instanitationCache[key] = typeMirror; |
| 1240 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1240 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
| 1241 _declarationCache[key] = typeMirror; | 1241 _declarationCache[key] = typeMirror; |
| 1242 } | 1242 } |
| 1243 } | 1243 } |
| 1244 return typeMirror; | 1244 return typeMirror; |
| 1245 } | 1245 } |
| 1246 } | 1246 } |
| OLD | NEW |