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

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

Issue 13942008: - Add synchronous mirror API. Resurrects invoke, apply, newInstance, (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
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | tests/lib/mirrors/mirrors_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 // 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 * functionality. 168 * functionality.
169 * 169 *
170 * For the purposes of the mirrors library, these types are all 170 * For the purposes of the mirrors library, these types are all
171 * object-like, in that they support method invocation and field 171 * object-like, in that they support method invocation and field
172 * access. Real Dart objects are represented by the [InstanceMirror] 172 * access. Real Dart objects are represented by the [InstanceMirror]
173 * type. 173 * type.
174 * 174 *
175 * See [InstanceMirror], [ClassMirror], and [LibraryMirror]. 175 * See [InstanceMirror], [ClassMirror], and [LibraryMirror].
176 */ 176 */
177 abstract class ObjectMirror implements Mirror { 177 abstract class ObjectMirror implements Mirror {
178
179 /**
180 * Invokes the named function and returns a mirror on the result.
181 * The arguments are objects local to the current isolate.
182 */
183 /* TODO(turnidge): Properly document.
184 * TODO(turnidge): Handle ambiguous names.
185 * TODO(turnidge): Handle optional & named arguments.
186 */
187 InstanceMirror invoke(Symbol memberName,
188 List positionalArguments,
189 [Map<Symbol,dynamic> namedArguments]);
190
191 /**
192 * Invokes a getter and returns a mirror on the result. The getter
193 * can be the implicit getter for a field or a user-defined getter
194 * method.
195 */
196 /* TODO(turnidge): Handle ambiguous names.*/
197 InstanceMirror getField(Symbol fieldName);
198
199 /**
200 * Invokes a setter and returns a mirror on the result. The setter
201 * may be either the implicit setter for a non-final field or a
202 * user-defined setter method.
203 * The argument is an object local to the current isolate.
204 */
205 /* TODO(turnidge): Handle ambiguous names.*/
206 InstanceMirror setField(Symbol fieldName, Object arg);
207
178 /** 208 /**
179 * Invokes the named function and returns a mirror on the result. 209 * Invokes the named function and returns a mirror on the result.
180 * The arguments must be instances of [InstanceMirror], [num], 210 * The arguments must be instances of [InstanceMirror], [num],
181 * [String], or [bool]. 211 * [String], or [bool].
182 */ 212 */
183 /* TODO(turnidge): Properly document. 213 /* TODO(turnidge): Properly document.
184 * TODO(turnidge): Handle ambiguous names. 214 * TODO(turnidge): Handle ambiguous names.
185 * TODO(turnidge): Handle optional & named arguments. 215 * TODO(turnidge): Handle optional & named arguments.
186 */ 216 */
187 Future<InstanceMirror> invokeAsync(Symbol memberName, 217 Future<InstanceMirror> invokeAsync(Symbol memberName,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 285
256 /** 286 /**
257 * The source code for this closure, if available. Otherwise null. 287 * The source code for this closure, if available. Otherwise null.
258 * 288 *
259 * TODO(turnidge): Would this just be available in function? 289 * TODO(turnidge): Would this just be available in function?
260 */ 290 */
261 String get source; 291 String get source;
262 292
263 /** 293 /**
264 * Executes the closure. 294 * Executes the closure.
295 * The arguments are objects local to the current isolate.
296 */
297 InstanceMirror apply(List<Object> positionalArguments,
298 [Map<Symbol,Object> namedArguments]);
299
300 /**
301 * Executes the closure.
265 * The arguments must be instances of [InstanceMirror], [num], 302 * The arguments must be instances of [InstanceMirror], [num],
266 * [String], or [bool]. 303 * [String], or [bool].
267 */ 304 */
268 Future<InstanceMirror> applyAsync(List<Object> positionalArguments, 305 Future<InstanceMirror> applyAsync(List<Object> positionalArguments,
269 [Map<Symbol, Object> namedArguments]); 306 [Map<Symbol, Object> namedArguments]);
270 307
271 /** 308 /**
272 * Looks up the value of a name in the scope of the closure. The 309 * Looks up the value of a name in the scope of the closure. The
273 * result is a mirror on that value. 310 * result is a mirror on that value.
274 */ 311 */
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 * For most classes, they are their own original declaration. For 467 * For most classes, they are their own original declaration. For
431 * generic classes, however, there is a distinction between the 468 * generic classes, however, there is a distinction between the
432 * original class declaration, which has unbound type variables, and 469 * original class declaration, which has unbound type variables, and
433 * the instantiations of generic classes, which have bound type 470 * the instantiations of generic classes, which have bound type
434 * variables. 471 * variables.
435 */ 472 */
436 ClassMirror get originalDeclaration; 473 ClassMirror get originalDeclaration;
437 474
438 /** 475 /**
439 * Invokes the named constructor and returns a mirror on the result. 476 * Invokes the named constructor and returns a mirror on the result.
477 * The arguments are objects local to the current isolate
478 */
479 /* TODO(turnidge): Properly document.*/
480 InstanceMirror newInstance(Symbol constructorName,
481 List positionalArguments,
482 [Map<Symbol,dynamic> namedArguments]);
483
484 /**
485 * Invokes the named constructor and returns a mirror on the result.
440 * The arguments must be instances of [InstanceMirror], [num], 486 * The arguments must be instances of [InstanceMirror], [num],
441 * [String], or [bool]. 487 * [String] or [bool].
442 */ 488 */
443 /* TODO(turnidge): Properly document.*/ 489 /* TODO(turnidge): Properly document.*/
444 Future<InstanceMirror> newInstanceAsync(Symbol constructorName, 490 Future<InstanceMirror> newInstanceAsync(Symbol constructorName,
445 List<Object> positionalArguments, 491 List<Object> positionalArguments,
446 [Map<Symbol, Object> namedArguments]); 492 [Map<Symbol, Object> namedArguments]);
447 493
448 /** 494 /**
449 * Does this mirror represent a class? 495 * Does this mirror represent a class?
450 * 496 *
451 * TODO(turnidge): This functions goes away after the 497 * TODO(turnidge): This functions goes away after the
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 /** 805 /**
760 * Is [:true:] if this comment is a documentation comment. 806 * Is [:true:] if this comment is a documentation comment.
761 * 807 *
762 * That is, that the comment is either enclosed in [: /** ... */ :] or starts 808 * That is, that the comment is either enclosed in [: /** ... */ :] or starts
763 * with [: /// :]. 809 * with [: /// :].
764 */ 810 */
765 final bool isDocComment; 811 final bool isDocComment;
766 812
767 const Comment(this.text, this.trimmedText, this.isDocComment); 813 const Comment(this.text, this.trimmedText, this.isDocComment);
768 } 814 }
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | tests/lib/mirrors/mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698