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

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

Issue 46893004: - Force errors when using bad types or overrides. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | « no previous file | tests/language/hello_dart_test.dart » ('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 import "dart:collection"; 7 import "dart:collection";
8 8
9 final emptyList = new UnmodifiableListView([]); 9 final emptyList = new UnmodifiableListView([]);
10 final emptyMap = new _UnmodifiableMapView({}); 10 final emptyMap = new _UnmodifiableMapView({});
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 this._invokeSetter(_reflectee, 214 this._invokeSetter(_reflectee,
215 _n(memberName), 215 _n(memberName),
216 value); 216 value);
217 return reflect(value); 217 return reflect(value);
218 } 218 }
219 219
220 static _validateArgument(int i, Object arg) 220 static _validateArgument(int i, Object arg)
221 { 221 {
222 if (arg is Mirror) { 222 if (arg is Mirror) {
223 if (arg is! InstanceMirror) { 223 if (arg is! InstanceMirror) {
224 throw new MirrorException( 224 throw /* new MirrorException */(
225 'positional argument $i ($arg) was not an InstanceMirror'); 225 'positional argument $i ($arg) was not an InstanceMirror');
226 } 226 }
227 } else if (!_isSimpleValue(arg)) { 227 } else if (!_isSimpleValue(arg)) {
228 throw new MirrorException( 228 throw /* new MirrorException */(
229 'positional argument $i ($arg) was not a simple value'); 229 'positional argument $i ($arg) was not a simple value');
230 } 230 }
231 } 231 }
232 } 232 }
233 233
234 class _LocalInstanceMirrorImpl extends _LocalObjectMirrorImpl 234 class _LocalInstanceMirrorImpl extends _LocalObjectMirrorImpl
235 implements InstanceMirror { 235 implements InstanceMirror {
236 // TODO(ahe): This is a hack, see delegate below. 236 // TODO(ahe): This is a hack, see delegate below.
237 static Function _invokeOnClosure; 237 static Function _invokeOnClosure;
238 238
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 bool get isRegularMethod => !isGetter && !isSetter && !isConstructor; 1245 bool get isRegularMethod => !isGetter && !isSetter && !isConstructor;
1246 1246
1247 Symbol _constructorName = null; 1247 Symbol _constructorName = null;
1248 Symbol get constructorName { 1248 Symbol get constructorName {
1249 if (_constructorName == null) { 1249 if (_constructorName == null) {
1250 if (!isConstructor) { 1250 if (!isConstructor) {
1251 _constructorName = _s(''); 1251 _constructorName = _s('');
1252 } else { 1252 } else {
1253 var parts = MirrorSystem.getName(simpleName).split('.'); 1253 var parts = MirrorSystem.getName(simpleName).split('.');
1254 if (parts.length > 2) { 1254 if (parts.length > 2) {
1255 throw new MirrorException( 1255 throw /* new MirrorException */(
siva 2013/11/04 16:32:20 Should this be new InternalError(...) the comment
1256 'Internal error in MethodMirror.constructorName: ' 1256 'Internal error in MethodMirror.constructorName: '
1257 'malformed name <$simpleName>'); 1257 'malformed name <$simpleName>');
1258 } else if (parts.length == 2) { 1258 } else if (parts.length == 2) {
1259 _constructorName = _s(parts[1]); 1259 _constructorName = _s(parts[1]);
1260 } else { 1260 } else {
1261 _constructorName = _s(''); 1261 _constructorName = _s('');
1262 } 1262 }
1263 } 1263 }
1264 } 1264 }
1265 return _constructorName; 1265 return _constructorName;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 if (typeMirror == null) { 1480 if (typeMirror == null) {
1481 typeMirror = makeLocalTypeMirror(key); 1481 typeMirror = makeLocalTypeMirror(key);
1482 _instanitationCache[key] = typeMirror; 1482 _instanitationCache[key] = typeMirror;
1483 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { 1483 if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
1484 _declarationCache[key] = typeMirror; 1484 _declarationCache[key] = typeMirror;
1485 } 1485 }
1486 } 1486 }
1487 return typeMirror; 1487 return typeMirror;
1488 } 1488 }
1489 } 1489 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/hello_dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698