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

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

Issue 20208002: Inline MethodMirror creation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 native 'LibraryMirror_invokeGetter'; 883 native 'LibraryMirror_invokeGetter';
884 884
885 _invokeSetter(reflectee, setterName, value) 885 _invokeSetter(reflectee, setterName, value)
886 native 'LibraryMirror_invokeSetter'; 886 native 'LibraryMirror_invokeSetter';
887 } 887 }
888 888
889 class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl 889 class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl
890 implements MethodMirror { 890 implements MethodMirror {
891 _LocalMethodMirrorImpl(reflectee, 891 _LocalMethodMirrorImpl(reflectee,
892 this._owner, 892 this._owner,
893 this.parameters,
894 this.isStatic, 893 this.isStatic,
895 this.isAbstract, 894 this.isAbstract,
896 this.isGetter, 895 this.isGetter,
897 this.isSetter, 896 this.isSetter,
898 this.isConstructor, 897 this.isConstructor,
899 this.isConstConstructor, 898 this.isConstConstructor,
900 this.isGenerativeConstructor, 899 this.isGenerativeConstructor,
901 this.isRedirectingConstructor, 900 this.isRedirectingConstructor,
902 this.isFactoryConstructor) : super(reflectee); 901 this.isFactoryConstructor) : super(reflectee);
903 902
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 if (_returnType == null) { 947 if (_returnType == null) {
949 if (isConstructor) { 948 if (isConstructor) {
950 _returnType = owner; 949 _returnType = owner;
951 } else { 950 } else {
952 _returnType = _MethodMirror_return_type(_reflectee); 951 _returnType = _MethodMirror_return_type(_reflectee);
953 } 952 }
954 } 953 }
955 return _returnType; 954 return _returnType;
956 } 955 }
957 956
958 final List<ParameterMirror> parameters; 957 List<ParameterMirror> _parameters = null;
958 List<ParameterMirror> get parameters {
959 if (_parameters == null) {
960 _parameters = _MethodMirror_parameters(_reflectee);
961 }
962 return _parameters;
963 }
959 964
960 final bool isStatic; 965 final bool isStatic;
961 final bool isAbstract; 966 final bool isAbstract;
962 967
963 bool get isRegularMethod => !isGetter && !isSetter && !isConstructor; 968 bool get isRegularMethod => !isGetter && !isSetter && !isConstructor;
964 969
965 TypeMirror get isOperator { 970 TypeMirror get isOperator {
966 throw new UnimplementedError( 971 throw new UnimplementedError(
967 'MethodMirror.isOperator is not implemented'); 972 'MethodMirror.isOperator is not implemented');
968 } 973 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 String toString() => "MethodMirror on '${_n(simpleName)}'"; 1005 String toString() => "MethodMirror on '${_n(simpleName)}'";
1001 1006
1002 static String _MethodMirror_name(reflectee) 1007 static String _MethodMirror_name(reflectee)
1003 native "MethodMirror_name"; 1008 native "MethodMirror_name";
1004 1009
1005 static dynamic _MethodMirror_owner(reflectee) 1010 static dynamic _MethodMirror_owner(reflectee)
1006 native "MethodMirror_owner"; 1011 native "MethodMirror_owner";
1007 1012
1008 static dynamic _MethodMirror_return_type(reflectee) 1013 static dynamic _MethodMirror_return_type(reflectee)
1009 native "MethodMirror_return_type"; 1014 native "MethodMirror_return_type";
1015
1016 static List<MethodMirror> _MethodMirror_parameters(reflectee)
1017 native "MethodMirror_parameters";
1010 } 1018 }
1011 1019
1012 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl 1020 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl
1013 implements VariableMirror { 1021 implements VariableMirror {
1014 _LocalVariableMirrorImpl(reflectee, 1022 _LocalVariableMirrorImpl(reflectee,
1015 String simpleName, 1023 String simpleName,
1016 this._owner, 1024 this._owner,
1017 this._type, 1025 this._type,
1018 this.isStatic, 1026 this.isStatic,
1019 this.isFinal) 1027 this.isFinal)
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1201 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1194 static ClassMirror reflectClass(Type key) { 1202 static ClassMirror reflectClass(Type key) {
1195 var classMirror = _classMirrorCache[key]; 1203 var classMirror = _classMirrorCache[key];
1196 if (classMirror == null) { 1204 if (classMirror == null) {
1197 classMirror = makeLocalClassMirror(key); 1205 classMirror = makeLocalClassMirror(key);
1198 _classMirrorCache[key] = classMirror; 1206 _classMirrorCache[key] = classMirror;
1199 } 1207 }
1200 return classMirror; 1208 return classMirror;
1201 } 1209 }
1202 } 1210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698