| 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 | 822 |
| 823 // get the metadata objects, convert them into InstanceMirrors using | 823 // get the metadata objects, convert them into InstanceMirrors using |
| 824 // reflect() and then make them into a Dart list | 824 // reflect() and then make them into a Dart list |
| 825 List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); | 825 List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); |
| 826 | 826 |
| 827 String toString() => "LibraryMirror on '${_n(simpleName)}'"; | 827 String toString() => "LibraryMirror on '${_n(simpleName)}'"; |
| 828 } | 828 } |
| 829 | 829 |
| 830 class _LocalMethodMirrorImpl extends _LocalMirrorImpl | 830 class _LocalMethodMirrorImpl extends _LocalMirrorImpl |
| 831 implements MethodMirror { | 831 implements MethodMirror { |
| 832 _LocalMethodMirrorImpl(String simpleName, | 832 _LocalMethodMirrorImpl(this._reflectee, |
| 833 this._owner, | 833 this._owner, |
| 834 this.parameters, | 834 this.parameters, |
| 835 this._returnType, | 835 this._returnType, |
| 836 this.isStatic, | 836 this.isStatic, |
| 837 this.isAbstract, | 837 this.isAbstract, |
| 838 this.isGetter, | 838 this.isGetter, |
| 839 this.isSetter, | 839 this.isSetter, |
| 840 this.isConstructor, | 840 this.isConstructor, |
| 841 this.isConstConstructor, | 841 this.isConstConstructor, |
| 842 this.isGenerativeConstructor, | 842 this.isGenerativeConstructor, |
| 843 this.isRedirectingConstructor, | 843 this.isRedirectingConstructor, |
| 844 this.isFactoryConstructor) | 844 this.isFactoryConstructor); |
| 845 : this.simpleName = _s(simpleName); | |
| 846 | 845 |
| 847 final Symbol simpleName; | 846 final _MirrorReference _reflectee; |
| 847 |
| 848 Symbol _simpleName = null; |
| 849 Symbol get simpleName { |
| 850 if (_simpleName == null) { |
| 851 _simpleName = _s(_MethodMirror_name(_reflectee)); |
| 852 } |
| 853 return _simpleName; |
| 854 } |
| 848 | 855 |
| 849 Symbol _qualifiedName = null; | 856 Symbol _qualifiedName = null; |
| 850 Symbol get qualifiedName { | 857 Symbol get qualifiedName { |
| 851 if (_qualifiedName == null) { | 858 if (_qualifiedName == null) { |
| 852 _qualifiedName = _computeQualifiedName(owner, simpleName); | 859 _qualifiedName = _computeQualifiedName(owner, simpleName); |
| 853 } | 860 } |
| 854 return _qualifiedName; | 861 return _qualifiedName; |
| 855 } | 862 } |
| 856 | 863 |
| 857 var _owner; | 864 var _owner; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 final bool isFactoryConstructor; | 932 final bool isFactoryConstructor; |
| 926 | 933 |
| 927 List<InstanceMirror> get metadata { | 934 List<InstanceMirror> get metadata { |
| 928 owner; // ensure owner is computed | 935 owner; // ensure owner is computed |
| 929 // get the metadata objects, convert them into InstanceMirrors using | 936 // get the metadata objects, convert them into InstanceMirrors using |
| 930 // reflect() and then make them into a Dart list | 937 // reflect() and then make them into a Dart list |
| 931 return _metadata(this).map(reflect).toList(); | 938 return _metadata(this).map(reflect).toList(); |
| 932 } | 939 } |
| 933 | 940 |
| 934 String toString() => "MethodMirror on '${_n(simpleName)}'"; | 941 String toString() => "MethodMirror on '${_n(simpleName)}'"; |
| 942 |
| 943 static String _MethodMirror_name(reflectee) |
| 944 native "MethodMirror_name"; |
| 935 } | 945 } |
| 936 | 946 |
| 937 class _LocalVariableMirrorImpl extends _LocalMirrorImpl | 947 class _LocalVariableMirrorImpl extends _LocalMirrorImpl |
| 938 implements VariableMirror { | 948 implements VariableMirror { |
| 939 _LocalVariableMirrorImpl(String simpleName, | 949 _LocalVariableMirrorImpl(String simpleName, |
| 940 this._owner, | 950 this._owner, |
| 941 this._type, | 951 this._type, |
| 942 this.isStatic, | 952 this.isStatic, |
| 943 this.isFinal) | 953 this.isFinal) |
| 944 : this.simpleName = _s(simpleName); | 954 : this.simpleName = _s(simpleName); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 } | 1066 } |
| 1057 | 1067 |
| 1058 // Creates a new local ClassMirror. | 1068 // Creates a new local ClassMirror. |
| 1059 static ClassMirror makeLocalClassMirror(Type key) | 1069 static ClassMirror makeLocalClassMirror(Type key) |
| 1060 native "Mirrors_makeLocalClassMirror"; | 1070 native "Mirrors_makeLocalClassMirror"; |
| 1061 | 1071 |
| 1062 static ClassMirror reflectClass(Type key) { | 1072 static ClassMirror reflectClass(Type key) { |
| 1063 return makeLocalClassMirror(key); | 1073 return makeLocalClassMirror(key); |
| 1064 } | 1074 } |
| 1065 } | 1075 } |
| OLD | NEW |