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

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

Issue 19839002: Improve test coverage of reflective invocation. (Closed) Base URL: http://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 | « no previous file | tests/lib/lib.status » ('j') | tests/lib/lib.status » ('J')
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } on MirroredError catch(e) { 219 } on MirroredError catch(e) {
220 return new Future.error(e); 220 return new Future.error(e);
221 } 221 }
222 } 222 }
223 223
224 Future<InstanceMirror> setFieldAsync(Symbol memberName, Object value) { 224 Future<InstanceMirror> setFieldAsync(Symbol memberName, Object value) {
225 try { 225 try {
226 var unwrappedValue; 226 var unwrappedValue;
227 if(_isSimpleValue(value)) { 227 if(_isSimpleValue(value)) {
228 unwrappedValue = value; 228 unwrappedValue = value;
229 } else if(wrappedArg is InstanceMirror) { 229 } else if(value is InstanceMirror) {
230 unwrappedValue = value._reflectee; 230 unwrappedValue = value._reflectee;
231 } else { 231 } else {
232 throw "setter argument ($value) must be a simple value or InstanceMirror "; 232 throw "setter argument ($value) must be a simple value or InstanceMirror ";
ahe 2013/07/20 16:34:59 Long line.
233 } 233 }
234 234
235 var result = this._invokeSetter(_reflectee, 235 var result = this._invokeSetter(_reflectee,
236 _n(memberName), 236 _n(memberName),
237 unwrappedValue); 237 unwrappedValue);
238 return new Future.value(reflect(result)); 238 return new Future.value(reflect(result));
239 } on MirroredError catch(e) { 239 } on MirroredError catch(e) {
240 return new Future.error(e); 240 return new Future.error(e);
241 } 241 }
242 } 242 }
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1138 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1139 static ClassMirror reflectClass(Type key) { 1139 static ClassMirror reflectClass(Type key) {
1140 var classMirror = _classMirrorCache[key]; 1140 var classMirror = _classMirrorCache[key];
1141 if (classMirror == null) { 1141 if (classMirror == null) {
1142 classMirror = makeLocalClassMirror(key); 1142 classMirror = makeLocalClassMirror(key);
1143 _classMirrorCache[key] = classMirror; 1143 _classMirrorCache[key] = classMirror;
1144 } 1144 }
1145 return classMirror; 1145 return classMirror;
1146 } 1146 }
1147 } 1147 }
OLDNEW
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | tests/lib/lib.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698