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

Side by Side Diff: sdk/lib/mirrors/mirrors.dart

Issue 13967003: EAKING CHANGE: Rename InstanceMIrror.invoke, .getField, .setField to invokeAsync, getFieldAsync, se… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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
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 // For the purposes of the mirrors library, we adopt a naming 5 // For the purposes of the mirrors library, we adopt a naming
6 // convention with respect to getters and setters. Specifically, for 6 // convention with respect to getters and setters. Specifically, for
7 // some variable or field... 7 // some variable or field...
8 // 8 //
9 // var myField; 9 // var myField;
10 // 10 //
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 * For the purposes of the mirrors library, these types are all 167 * For the purposes of the mirrors library, these types are all
168 * object-like, in that they support method invocation and field 168 * object-like, in that they support method invocation and field
169 * access. Real Dart objects are represented by the [InstanceMirror] 169 * access. Real Dart objects are represented by the [InstanceMirror]
170 * type. 170 * type.
171 * 171 *
172 * See [InstanceMirror], [ClassMirror], and [LibraryMirror]. 172 * See [InstanceMirror], [ClassMirror], and [LibraryMirror].
173 */ 173 */
174 abstract class ObjectMirror implements Mirror { 174 abstract class ObjectMirror implements Mirror {
175 /** 175 /**
176 * Invokes the named function and returns a mirror on the result. 176 * Invokes the named function and returns a mirror on the result.
177 * 177 * The arguments must be instances of [InstanceMirror], [num],
178 * TODO(turnidge): Properly document. 178 * [String] or [bool].
179 */
180 /* TODO(turnidge): Properly document.
179 * TODO(turnidge): Handle ambiguous names. 181 * TODO(turnidge): Handle ambiguous names.
180 * TODO(turnidge): Handle optional & named arguments. 182 * TODO(turnidge): Handle optional & named arguments.
181 */ 183 */
182 Future<InstanceMirror> invoke(String memberName, 184 Future<InstanceMirror> invokeAsync(String memberName,
183 List<Object> positionalArguments, 185 List<Object> positionalArguments,
184 [Map<String,Object> namedArguments]); 186 [Map<String,Object> namedArguments]);
185 187
186 /** 188 /**
187 * Invokes a getter and returns a mirror on the result. The getter 189 * Invokes a getter and returns a mirror on the result. The getter
188 * can be the implicit getter for a field or a user-defined getter 190 * can be the implicit getter for a field or a user-defined getter
189 * method. 191 * method.
190 *
191 * TODO(turnidge): Handle ambiguous names.
192 */ 192 */
193 Future<InstanceMirror> getField(String fieldName); 193 /* TODO(turnidge): Handle ambiguous names.*/
194 Future<InstanceMirror> getFieldAsync(String fieldName);
194 195
195 /** 196 /**
196 * Invokes a setter and returns a mirror on the result. The setter 197 * Invokes a setter and returns a mirror on the result. The setter
197 * may be either the implicit setter for a non-final field or a 198 * may be either the implicit setter for a non-final field or a
198 * user-defined setter method. 199 * user-defined setter method.
199 * 200 * The argument must be an instance of either [InstanceMirror], [num],
200 * TODO(turnidge): Handle ambiguous names. 201 * [String] or [bool].
201 */ 202 */
202 Future<InstanceMirror> setField(String fieldName, Object value); 203 /* TODO(turnidge): Handle ambiguous names.*/
204 Future<InstanceMirror> setFieldAsync(String fieldName, Object value);
203 } 205 }
204 206
205 /** 207 /**
206 * An [InstanceMirror] reflects an instance of a Dart language object. 208 * An [InstanceMirror] reflects an instance of a Dart language object.
207 */ 209 */
208 abstract class InstanceMirror implements ObjectMirror { 210 abstract class InstanceMirror implements ObjectMirror {
209 /** 211 /**
210 * A mirror on the type of the reflectee. 212 * A mirror on the type of the reflectee.
211 */ 213 */
212 ClassMirror get type; 214 ClassMirror get type;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 MethodMirror get function; 251 MethodMirror get function;
250 252
251 /** 253 /**
252 * The source code for this closure, if available. Otherwise null. 254 * The source code for this closure, if available. Otherwise null.
253 * 255 *
254 * TODO(turnidge): Would this just be available in function? 256 * TODO(turnidge): Would this just be available in function?
255 */ 257 */
256 String get source; 258 String get source;
257 259
258 /** 260 /**
259 * Executes the closure. The arguments given in the descriptor need to 261 * Executes the closure.
260 * be InstanceMirrors or simple values. 262 * The arguments must be instances of [InstanceMirror], [num],
261 * 263 * [String] or [bool].
262 * A value is simple if one of the following holds:
263 * - the value is null
264 * - the value is of type [num]
265 * - the value is of type [bool]
266 * - the value is of type [String]
267 */ 264 */
268 Future<InstanceMirror> apply(List<Object> positionalArguments, 265 Future<InstanceMirror> applyAsync(List<Object> positionalArguments,
269 [Map<String,Object> namedArguments]); 266 [Map<String,Object> namedArguments]);
270 267
271 /** 268 /**
272 * Looks up the value of a name in the scope of the closure. The 269 * Looks up the value of a name in the scope of the closure. The
273 * result is a mirror on that value. 270 * result is a mirror on that value.
274 */ 271 */
275 Future<InstanceMirror> findInContext(String name); 272 Future<InstanceMirror> findInContext(String name);
276 } 273 }
277 274
278 /** 275 /**
279 * A [LibraryMirror] reflects a Dart language library, providing 276 * A [LibraryMirror] reflects a Dart language library, providing
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 * For most classes, they are their own original declaration. For 426 * For most classes, they are their own original declaration. For
430 * generic classes, however, there is a distinction between the 427 * generic classes, however, there is a distinction between the
431 * original class declaration, which has unbound type variables, and 428 * original class declaration, which has unbound type variables, and
432 * the instantiations of generic classes, which have bound type 429 * the instantiations of generic classes, which have bound type
433 * variables. 430 * variables.
434 */ 431 */
435 ClassMirror get originalDeclaration; 432 ClassMirror get originalDeclaration;
436 433
437 /** 434 /**
438 * Invokes the named constructor and returns a mirror on the result. 435 * Invokes the named constructor and returns a mirror on the result.
439 * 436 * The arguments must be instances of [InstanceMirror], [num],
440 * TODO(turnidge): Properly document.
441 */ 437 */
442 Future<InstanceMirror> newInstance(String constructorName, 438 /* TODO(turnidge): Properly document.*/
443 List<Object> positionalArguments, 439 Future<InstanceMirror> newInstanceAsync(String constructorName,
444 [Map<String,Object> namedArguments]); 440 List<Object> positionalArguments,
441 [Map<String,Object> namedArguments]);
445 442
446 /** 443 /**
447 * Does this mirror represent a class? 444 * Does this mirror represent a class?
448 * 445 *
449 * TODO(turnidge): This functions goes away after the 446 * TODO(turnidge): This functions goes away after the
450 * class/interface changes. 447 * class/interface changes.
451 */ 448 */
452 bool get isClass; 449 bool get isClass;
453 450
454 /** 451 /**
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 /** 756 /**
760 * Is [:true:] if this comment is a documentation comment. 757 * Is [:true:] if this comment is a documentation comment.
761 * 758 *
762 * That is, that the comment is either enclosed in [: /** ... */ :] or starts 759 * That is, that the comment is either enclosed in [: /** ... */ :] or starts
763 * with [: /// :]. 760 * with [: /// :].
764 */ 761 */
765 final bool isDocComment; 762 final bool isDocComment;
766 763
767 const Comment(this.text, this.trimmedText, this.isDocComment); 764 const Comment(this.text, this.trimmedText, this.isDocComment);
768 } 765 }
OLDNEW
« no previous file with comments | « runtime/tests/vm/dart/isolate_mirror_local_test.dart ('k') | tests/lib/mirrors/mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698