| 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 Symbol _qualifiedName = null; | 415 Symbol _qualifiedName = null; |
| 416 Symbol get qualifiedName { | 416 Symbol get qualifiedName { |
| 417 if (_qualifiedName == null) { | 417 if (_qualifiedName == null) { |
| 418 _qualifiedName = _computeQualifiedName(owner, simpleName); | 418 _qualifiedName = _computeQualifiedName(owner, simpleName); |
| 419 } | 419 } |
| 420 return _qualifiedName; | 420 return _qualifiedName; |
| 421 } | 421 } |
| 422 | 422 |
| 423 var _owner; | 423 var _owner; |
| 424 DeclarationMirror get owner { | 424 DeclarationMirror get owner { |
| 425 if (_owner != null && _owner is! Mirror) { | 425 if (_owner == null) { |
| 426 _owner = _library(_reflectee); |
| 427 } |
| 428 if (_owner is! Mirror) { |
| 426 _owner = _owner.resolve(mirrors); | 429 _owner = _owner.resolve(mirrors); |
| 427 } | 430 } |
| 428 return _owner; | 431 return _owner; |
| 429 } | 432 } |
| 430 | 433 |
| 431 bool get isPrivate => _n(simpleName).startsWith('_'); | 434 bool get isPrivate => _n(simpleName).startsWith('_'); |
| 432 | 435 |
| 433 final bool isTopLevel = true; | 436 final bool isTopLevel = true; |
| 434 | 437 |
| 435 SourceLocation get location { | 438 SourceLocation get location { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 569 |
| 567 List<InstanceMirror> get metadata { | 570 List<InstanceMirror> get metadata { |
| 568 // get the metadata objects, convert them into InstanceMirrors using | 571 // get the metadata objects, convert them into InstanceMirrors using |
| 569 // reflect() and then make them into a Dart list | 572 // reflect() and then make them into a Dart list |
| 570 return _metadata(_reflectee).map(reflect).toList(); | 573 return _metadata(_reflectee).map(reflect).toList(); |
| 571 } | 574 } |
| 572 | 575 |
| 573 static _name(reflectee) | 576 static _name(reflectee) |
| 574 native "ClassMirror_name"; | 577 native "ClassMirror_name"; |
| 575 | 578 |
| 579 static _library(reflectee) |
| 580 native "ClassMirror_library"; |
| 581 |
| 576 _invoke(reflectee, memberName, positionalArguments) | 582 _invoke(reflectee, memberName, positionalArguments) |
| 577 native 'ClassMirror_invoke'; | 583 native 'ClassMirror_invoke'; |
| 578 | 584 |
| 579 _invokeGetter(reflectee, getterName) | 585 _invokeGetter(reflectee, getterName) |
| 580 native 'ClassMirror_invokeGetter'; | 586 native 'ClassMirror_invokeGetter'; |
| 581 | 587 |
| 582 _invokeSetter(reflectee, setterName, value) | 588 _invokeSetter(reflectee, setterName, value) |
| 583 native 'ClassMirror_invokeSetter'; | 589 native 'ClassMirror_invokeSetter'; |
| 584 | 590 |
| 585 static _invokeConstructor(reflectee, constructorName, positionalArguments) | 591 static _invokeConstructor(reflectee, constructorName, positionalArguments) |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 } | 1123 } |
| 1118 | 1124 |
| 1119 // Creates a new local ClassMirror. | 1125 // Creates a new local ClassMirror. |
| 1120 static ClassMirror makeLocalClassMirror(Type key) | 1126 static ClassMirror makeLocalClassMirror(Type key) |
| 1121 native "Mirrors_makeLocalClassMirror"; | 1127 native "Mirrors_makeLocalClassMirror"; |
| 1122 | 1128 |
| 1123 static ClassMirror reflectClass(Type key) { | 1129 static ClassMirror reflectClass(Type key) { |
| 1124 return makeLocalClassMirror(key); | 1130 return makeLocalClassMirror(key); |
| 1125 } | 1131 } |
| 1126 } | 1132 } |
| OLD | NEW |