Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(946)

Side by Side Diff: runtime/lib/mirrors_impl.dart

Issue 19579006: Adding proper handling for MethodMirror.owner (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final signatures for non-api functions; Renamed old ones Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 Symbol _qualifiedName = null; 891 Symbol _qualifiedName = null;
892 Symbol get qualifiedName { 892 Symbol get qualifiedName {
893 if (_qualifiedName == null) { 893 if (_qualifiedName == null) {
894 _qualifiedName = _computeQualifiedName(owner, simpleName); 894 _qualifiedName = _computeQualifiedName(owner, simpleName);
895 } 895 }
896 return _qualifiedName; 896 return _qualifiedName;
897 } 897 }
898 898
899 var _owner; 899 var _owner;
900 DeclarationMirror get owner { 900 DeclarationMirror get owner {
901 // For nested closures it is possible, that the mirror for the owner has not
902 // been created yet.
903 if (_owner == null) {
904 _owner = _MethodMirror_owner(_reflectee);
905 }
906 // TODO(mlippautz): This will go away, as soon as lazy mirrors go away.
901 if (_owner is! Mirror) { 907 if (_owner is! Mirror) {
902 _owner = _owner.resolve(mirrors); 908 _owner = _owner.resolve(mirrors);
903 } 909 }
904 return _owner; 910 return _owner;
905 } 911 }
906 912
907 bool get isPrivate { 913 bool get isPrivate {
908 return _n(simpleName).startsWith('_') || 914 return _n(simpleName).startsWith('_') ||
909 _n(constructorName).startsWith('_'); 915 _n(constructorName).startsWith('_');
910 } 916 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 owner; // ensure owner is computed 976 owner; // ensure owner is computed
971 // get the metadata objects, convert them into InstanceMirrors using 977 // get the metadata objects, convert them into InstanceMirrors using
972 // reflect() and then make them into a Dart list 978 // reflect() and then make them into a Dart list
973 return _metadata(this).map(reflect).toList(); 979 return _metadata(this).map(reflect).toList();
974 } 980 }
975 981
976 String toString() => "MethodMirror on '${_n(simpleName)}'"; 982 String toString() => "MethodMirror on '${_n(simpleName)}'";
977 983
978 static String _MethodMirror_name(reflectee) 984 static String _MethodMirror_name(reflectee)
979 native "MethodMirror_name"; 985 native "MethodMirror_name";
986
987 static dynamic _MethodMirror_owner(reflectee)
988 native "MethodMirror_owner";
980 } 989 }
981 990
982 class _LocalVariableMirrorImpl extends _LocalMirrorImpl 991 class _LocalVariableMirrorImpl extends _LocalMirrorImpl
983 implements VariableMirror { 992 implements VariableMirror {
984 _LocalVariableMirrorImpl(String simpleName, 993 _LocalVariableMirrorImpl(String simpleName,
985 this._owner, 994 this._owner,
986 this._type, 995 this._type,
987 this.isStatic, 996 this.isStatic,
988 this.isFinal) 997 this.isFinal)
989 : this.simpleName = _s(simpleName); 998 : this.simpleName = _s(simpleName);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 } 1135 }
1127 1136
1128 // Creates a new local ClassMirror. 1137 // Creates a new local ClassMirror.
1129 static ClassMirror makeLocalClassMirror(Type key) 1138 static ClassMirror makeLocalClassMirror(Type key)
1130 native "Mirrors_makeLocalClassMirror"; 1139 native "Mirrors_makeLocalClassMirror";
1131 1140
1132 static ClassMirror reflectClass(Type key) { 1141 static ClassMirror reflectClass(Type key) {
1133 return makeLocalClassMirror(key); 1142 return makeLocalClassMirror(key);
1134 } 1143 }
1135 } 1144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698