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

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

Issue 20006003: Fix a regression in ObjectMirror.setFieldAsync. (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 | no next file » | 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 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"
233 "a simple value or InstanceMirror";
233 } 234 }
234 235
235 var result = this._invokeSetter(_reflectee, 236 var result = this._invokeSetter(_reflectee,
236 _n(memberName), 237 _n(memberName),
237 unwrappedValue); 238 unwrappedValue);
238 return new Future.value(reflect(result)); 239 return new Future.value(reflect(result));
239 } on MirroredError catch(e) { 240 } on MirroredError catch(e) {
240 return new Future.error(e); 241 return new Future.error(e);
241 } 242 }
242 } 243 }
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1163 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1163 static ClassMirror reflectClass(Type key) { 1164 static ClassMirror reflectClass(Type key) {
1164 var classMirror = _classMirrorCache[key]; 1165 var classMirror = _classMirrorCache[key];
1165 if (classMirror == null) { 1166 if (classMirror == null) {
1166 classMirror = makeLocalClassMirror(key); 1167 classMirror = makeLocalClassMirror(key);
1167 _classMirrorCache[key] = classMirror; 1168 _classMirrorCache[key] = classMirror;
1168 } 1169 }
1169 return classMirror; 1170 return classMirror;
1170 } 1171 }
1171 } 1172 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698