| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 Symbol _qualifiedName = null; | 433 Symbol _qualifiedName = null; |
| 434 Symbol get qualifiedName { | 434 Symbol get qualifiedName { |
| 435 if (_qualifiedName == null) { | 435 if (_qualifiedName == null) { |
| 436 _qualifiedName = _computeQualifiedName(owner, simpleName); | 436 _qualifiedName = _computeQualifiedName(owner, simpleName); |
| 437 } | 437 } |
| 438 return _qualifiedName; | 438 return _qualifiedName; |
| 439 } | 439 } |
| 440 | 440 |
| 441 var _owner; | 441 var _owner; |
| 442 DeclarationMirror get owner { | 442 DeclarationMirror get owner { |
| 443 if (_owner != null && _owner is! Mirror) { | 443 if (_owner == null) { |
| 444 _owner = _library(_reflectee); |
| 445 } |
| 446 if (_owner is! Mirror) { |
| 444 _owner = _owner.resolve(mirrors); | 447 _owner = _owner.resolve(mirrors); |
| 445 } | 448 } |
| 446 return _owner; | 449 return _owner; |
| 447 } | 450 } |
| 448 | 451 |
| 449 bool get isPrivate => _n(simpleName).startsWith('_'); | 452 bool get isPrivate => _n(simpleName).startsWith('_'); |
| 450 | 453 |
| 451 final bool isTopLevel = true; | 454 final bool isTopLevel = true; |
| 452 | 455 |
| 453 SourceLocation get location { | 456 SourceLocation get location { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 586 } |
| 584 | 587 |
| 585 // get the metadata objects, convert them into InstanceMirrors using | 588 // get the metadata objects, convert them into InstanceMirrors using |
| 586 // reflect() and then make them into a Dart list | 589 // reflect() and then make them into a Dart list |
| 587 List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); | 590 List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); |
| 588 | 591 |
| 589 | 592 |
| 590 static _name(reflectee) | 593 static _name(reflectee) |
| 591 native "ClassMirror_name"; | 594 native "ClassMirror_name"; |
| 592 | 595 |
| 596 static _library(reflectee) |
| 597 native "ClassMirror_library"; |
| 598 |
| 593 _invoke(reflectee, memberName, positionalArguments) | 599 _invoke(reflectee, memberName, positionalArguments) |
| 594 native 'ClassMirror_invoke'; | 600 native 'ClassMirror_invoke'; |
| 595 | 601 |
| 596 _invokeGetter(reflectee, getterName) | 602 _invokeGetter(reflectee, getterName) |
| 597 native 'ClassMirror_invokeGetter'; | 603 native 'ClassMirror_invokeGetter'; |
| 598 | 604 |
| 599 _invokeSetter(reflectee, setterName, value) | 605 _invokeSetter(reflectee, setterName, value) |
| 600 native 'ClassMirror_invokeSetter'; | 606 native 'ClassMirror_invokeSetter'; |
| 601 | 607 |
| 602 static _invokeConstructor(reflectee, constructorName, positionalArguments) | 608 static _invokeConstructor(reflectee, constructorName, positionalArguments) |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 } | 1132 } |
| 1127 | 1133 |
| 1128 // Creates a new local ClassMirror. | 1134 // Creates a new local ClassMirror. |
| 1129 static ClassMirror makeLocalClassMirror(Type key) | 1135 static ClassMirror makeLocalClassMirror(Type key) |
| 1130 native "Mirrors_makeLocalClassMirror"; | 1136 native "Mirrors_makeLocalClassMirror"; |
| 1131 | 1137 |
| 1132 static ClassMirror reflectClass(Type key) { | 1138 static ClassMirror reflectClass(Type key) { |
| 1133 return makeLocalClassMirror(key); | 1139 return makeLocalClassMirror(key); |
| 1134 } | 1140 } |
| 1135 } | 1141 } |
| OLD | NEW |