OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 * If the invocation returns a result *r*, this method returns | 439 * If the invocation returns a result *r*, this method returns |
440 * the result of calling [reflect]\([value]\). | 440 * the result of calling [reflect]\([value]\). |
441 * If the invocation causes a compilation error | 441 * If the invocation causes a compilation error |
442 * the effect is the same as if a non-reflective compilation error | 442 * the effect is the same as if a non-reflective compilation error |
443 * had been encountered. | 443 * had been encountered. |
444 * If the invocation throws an exception *e* (that it does not catch) | 444 * If the invocation throws an exception *e* (that it does not catch) |
445 * this method throws *e*. | 445 * this method throws *e*. |
446 */ | 446 */ |
447 /* TODO(turnidge): Handle ambiguous names.*/ | 447 /* TODO(turnidge): Handle ambiguous names.*/ |
448 InstanceMirror setField(Symbol fieldName, Object value); | 448 InstanceMirror setField(Symbol fieldName, Object value); |
| 449 |
| 450 /** |
| 451 * Perform [invocation] on [reflectee]. |
| 452 * Equivalent to |
| 453 * |
| 454 * if (invocation.isGetter) { |
| 455 * return this.getField(invocation.memberName).reflectee; |
| 456 * } else if (invocation.isSetter) { |
| 457 * return this.setField(invocation.memberName, |
| 458 * invocation.positionArguments[0]).reflectee; |
| 459 * } else { |
| 460 * return this.invoke(invocation.memberName, |
| 461 * invocation.positionalArguments, |
| 462 * invocation.namedArguments).reflectee; |
| 463 * } |
| 464 */ |
| 465 delegate(Invocation invocation); |
449 } | 466 } |
450 | 467 |
451 /** | 468 /** |
452 * An [InstanceMirror] reflects an instance of a Dart language object. | 469 * An [InstanceMirror] reflects an instance of a Dart language object. |
453 */ | 470 */ |
454 abstract class InstanceMirror implements ObjectMirror { | 471 abstract class InstanceMirror implements ObjectMirror { |
455 /** | 472 /** |
456 * A mirror on the type of the reflectee. | 473 * A mirror on the type of the reflectee. |
457 * | 474 * |
458 * Returns a mirror on the actual class of the reflectee. | 475 * Returns a mirror on the actual class of the reflectee. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 * (1) [other] is a mirror of the same kind | 509 * (1) [other] is a mirror of the same kind |
493 * and | 510 * and |
494 * (2) either | 511 * (2) either |
495 * (a) [hasReflectee] is true and so is | 512 * (a) [hasReflectee] is true and so is |
496 * [:identical(reflectee, other.reflectee):] | 513 * [:identical(reflectee, other.reflectee):] |
497 * or | 514 * or |
498 * (b) the remote objects reflected by this mirror and | 515 * (b) the remote objects reflected by this mirror and |
499 * by [other] are identical. | 516 * by [other] are identical. |
500 */ | 517 */ |
501 bool operator == (other); | 518 bool operator == (other); |
502 | |
503 /** | |
504 * Perform [invocation] on [reflectee]. | |
505 * Equivalent to | |
506 * | |
507 * if (invocation.isGetter) { | |
508 * return this.getField(invocation.memberName).reflectee; | |
509 * } else if (invocation.isSetter) { | |
510 * return this.setField(invocation.memberName, | |
511 * invocation.positionArguments[0]).reflectee; | |
512 * } else { | |
513 * return this.invoke(invocation.memberName, | |
514 * invocation.positionalArguments, | |
515 * invocation.namedArguments).reflectee; | |
516 * } | |
517 */ | |
518 delegate(Invocation invocation); | |
519 } | 519 } |
520 | 520 |
521 /** | 521 /** |
522 * A [ClosureMirror] reflects a closure. | 522 * A [ClosureMirror] reflects a closure. |
523 * | 523 * |
524 * A [ClosureMirror] provides the ability to execute its reflectee and | 524 * A [ClosureMirror] provides the ability to execute its reflectee and |
525 * introspect its function. | 525 * introspect its function. |
526 */ | 526 */ |
527 abstract class ClosureMirror implements InstanceMirror { | 527 abstract class ClosureMirror implements InstanceMirror { |
528 /** | 528 /** |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 final override; | 1430 final override; |
1431 | 1431 |
1432 /** | 1432 /** |
1433 * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets], | 1433 * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets], |
1434 * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation | 1434 * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation |
1435 * of the parameters. | 1435 * of the parameters. |
1436 */ | 1436 */ |
1437 const MirrorsUsed( | 1437 const MirrorsUsed( |
1438 {this.symbols, this.targets, this.metaTargets, this.override}); | 1438 {this.symbols, this.targets, this.metaTargets, this.override}); |
1439 } | 1439 } |
OLD | NEW |