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

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

Issue 19983003: Create ParameterMirror.type lazily. (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
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 final bool isFinal; 1051 final bool isFinal;
1052 1052
1053 String toString() => "VariableMirror on '${_n(simpleName)}'"; 1053 String toString() => "VariableMirror on '${_n(simpleName)}'";
1054 1054
1055 static _VariableMirror_type(reflectee) 1055 static _VariableMirror_type(reflectee)
1056 native "VariableMirror_type"; 1056 native "VariableMirror_type";
1057 } 1057 }
1058 1058
1059 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl 1059 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl
1060 implements ParameterMirror { 1060 implements ParameterMirror {
1061 _LocalParameterMirrorImpl(type, this.isOptional) 1061 _LocalParameterMirrorImpl(this._reflectee,
1062 : super(null, '<TODO:unnamed>', null, type, false, false) {} 1062 this._position,
1063 this.isOptional)
1064 : super(null, '<TODO:unnamed>', null, null, false, false);
1063 1065
1066 final _MirrorReference _reflectee;
1067 final int _position;
1064 final bool isOptional; 1068 final bool isOptional;
1065 1069
1066 String get defaultValue { 1070 String get defaultValue {
1067 throw new UnimplementedError( 1071 throw new UnimplementedError(
1068 'ParameterMirror.defaultValue is not implemented'); 1072 'ParameterMirror.defaultValue is not implemented');
1069 } 1073 }
1070 1074
1071 bool get hasDefaultValue { 1075 bool get hasDefaultValue {
1072 throw new UnimplementedError( 1076 throw new UnimplementedError(
1073 'ParameterMirror.hasDefaultValue is not implemented'); 1077 'ParameterMirror.hasDefaultValue is not implemented');
1074 } 1078 }
1075 1079
1076 // TODO(11418): Implement. 1080 // TODO(11418): Implement.
1077 List<InstanceMirror> get metadata { 1081 List<InstanceMirror> get metadata {
1078 throw new UnimplementedError( 1082 throw new UnimplementedError(
1079 'ParameterMirror.metadata is not implemented'); 1083 'ParameterMirror.metadata is not implemented');
1080 } 1084 }
1085
1086 TypeMirror _type = null;
1087 TypeMirror get type {
1088 if (_type == null) {
1089 _type = _ParameterMirror_type(_reflectee, _position);
1090 }
1091 return _type;
1092 }
1093
1094 static TypeMirror _ParameterMirror_type(_reflectee, _position)
1095 native "ParameterMirror_type";
1081 } 1096 }
1082 1097
1083 class _SpecialTypeMirrorImpl extends _LocalMirrorImpl 1098 class _SpecialTypeMirrorImpl extends _LocalMirrorImpl
1084 implements TypeMirror, DeclarationMirror { 1099 implements TypeMirror, DeclarationMirror {
1085 _SpecialTypeMirrorImpl(String name) : simpleName = _s(name); 1100 _SpecialTypeMirrorImpl(String name) : simpleName = _s(name);
1086 1101
1087 final bool isPrivate = false; 1102 final bool isPrivate = false;
1088 final bool isTopLevel = true; 1103 final bool isTopLevel = true;
1089 1104
1090 // Fixed length 0, therefore immutable. 1105 // Fixed length 0, therefore immutable.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1178 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1164 static ClassMirror reflectClass(Type key) { 1179 static ClassMirror reflectClass(Type key) {
1165 var classMirror = _classMirrorCache[key]; 1180 var classMirror = _classMirrorCache[key];
1166 if (classMirror == null) { 1181 if (classMirror == null) {
1167 classMirror = makeLocalClassMirror(key); 1182 classMirror = makeLocalClassMirror(key);
1168 _classMirrorCache[key] = classMirror; 1183 _classMirrorCache[key] = classMirror;
1169 } 1184 }
1170 return classMirror; 1185 return classMirror;
1171 } 1186 }
1172 } 1187 }
OLDNEW
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698