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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/math_patch.dart ('k') | runtime/lib/regexp.cc » ('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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 // Walk the arguments and make sure they are legal. 150 // Walk the arguments and make sure they are legal.
151 for (int i = 0; i < positionalArguments.length; i++) { 151 for (int i = 0; i < positionalArguments.length; i++) {
152 var arg = positionalArguments[i]; 152 var arg = positionalArguments[i];
153 _validateArgument(i, arg); 153 _validateArgument(i, arg);
154 } 154 }
155 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); 155 Completer<InstanceMirror> completer = new Completer<InstanceMirror>();
156 try { 156 try {
157 completer.complete( 157 completer.complete(
158 _invoke(this, memberName, positionalArguments)); 158 _invoke(this, memberName, positionalArguments));
159 } catch (exception) { 159 } catch (exception, s) {
160 completer.completeException(exception); 160 completer.completeError(exception, s);
161 } 161 }
162 return completer.future; 162 return completer.future;
163 } 163 }
164 164
165 Future<InstanceMirror> getField(String fieldName) 165 Future<InstanceMirror> getField(String fieldName)
166 { 166 {
167 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); 167 Completer<InstanceMirror> completer = new Completer<InstanceMirror>();
168 try { 168 try {
169 completer.complete(_getField(this, fieldName)); 169 completer.complete(_getField(this, fieldName));
170 } catch (exception) { 170 } catch (exception, s) {
171 completer.completeException(exception); 171 completer.completeError(exception, s);
172 } 172 }
173 return completer.future; 173 return completer.future;
174 } 174 }
175 175
176 Future<InstanceMirror> setField(String fieldName, Object arg) 176 Future<InstanceMirror> setField(String fieldName, Object arg)
177 { 177 {
178 _validateArgument(0, arg); 178 _validateArgument(0, arg);
179 179
180 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); 180 Completer<InstanceMirror> completer = new Completer<InstanceMirror>();
181 try { 181 try {
182 completer.complete(_setField(this, fieldName, arg)); 182 completer.complete(_setField(this, fieldName, arg));
183 } catch (exception) { 183 } catch (exception, s) {
184 completer.completeException(exception); 184 completer.completeError(exception, s);
185 } 185 }
186 return completer.future; 186 return completer.future;
187 } 187 }
188 188
189 static _validateArgument(int i, Object arg) 189 static _validateArgument(int i, Object arg)
190 { 190 {
191 if (arg is Mirror) { 191 if (arg is Mirror) {
192 if (arg is! InstanceMirror) { 192 if (arg is! InstanceMirror) {
193 throw new MirrorException( 193 throw new MirrorException(
194 'positional argument $i ($arg) was not an InstanceMirror'); 194 'positional argument $i ($arg) was not an InstanceMirror');
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 964
965 // Creates a new local InstanceMirror 965 // Creates a new local InstanceMirror
966 static InstanceMirror makeLocalInstanceMirror(Object reflectee) 966 static InstanceMirror makeLocalInstanceMirror(Object reflectee)
967 native 'Mirrors_makeLocalInstanceMirror'; 967 native 'Mirrors_makeLocalInstanceMirror';
968 968
969 // Creates a new local mirror for some Object. 969 // Creates a new local mirror for some Object.
970 static InstanceMirror reflect(Object reflectee) { 970 static InstanceMirror reflect(Object reflectee) {
971 return makeLocalInstanceMirror(reflectee); 971 return makeLocalInstanceMirror(reflectee);
972 } 972 }
973 } 973 }
OLDNEW
« no previous file with comments | « runtime/lib/math_patch.dart ('k') | runtime/lib/regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698