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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 475 |
476 /** | 476 /** |
477 * Perform [invocation] on [reflectee]. | 477 * Perform [invocation] on [reflectee]. |
478 * Equivalent to | 478 * Equivalent to |
479 * | 479 * |
480 * this.invoke(invocation.memberName, | 480 * this.invoke(invocation.memberName, |
481 * invocation.positionalArguments, | 481 * invocation.positionalArguments, |
482 * invocation.namedArguments); | 482 * invocation.namedArguments); |
483 */ | 483 */ |
484 delegate(Invocation invocation); | 484 delegate(Invocation invocation); |
485 | |
486 /** | |
487 * Returns a closure for invoking the regular method named [name]. | |
488 * | |
489 * If [:type.instanceLookup(name):] returns a regular method m, the result of | |
490 * this method is a closure equivalent to: | |
491 * | |
492 * (r1, ..., rn, {p1: d1, ..., pk: dk}) { | |
493 * return this.invoke(name, [r1, ..., rn], {#p1: p1, ..., #pk: pk}); | |
494 * } | |
495 * | |
496 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk | |
497 * with defaults d1, ..., dk. The result of this method is a | |
498 * closure equivalent to: | |
499 * | |
500 * (r1, ..., rn, [p1 = d1, ..., pk = dk]) { | |
501 * return this.invoke(name, [r1, ..., rn, p1, ..., pk]); | |
502 * } | |
503 * | |
504 * if m has required parameters r1, ..., rn, and optional positional | |
505 * parameters p1, ..., pk with defaults d1, ..., dk. Otherwise, an | |
506 * [ArgumentError] is thrown. | |
507 */ | |
508 Function operator [](Symbol name); | |
509 } | 485 } |
510 | 486 |
511 /** | 487 /** |
512 * A [ClosureMirror] reflects a closure. | 488 * A [ClosureMirror] reflects a closure. |
513 * | 489 * |
514 * A [ClosureMirror] provides access to its captured variables and | 490 * A [ClosureMirror] provides access to its captured variables and |
515 * provides the ability to execute its reflectee. | 491 * provides the ability to execute its reflectee. |
516 */ | 492 */ |
517 abstract class ClosureMirror implements InstanceMirror { | 493 abstract class ClosureMirror implements InstanceMirror { |
518 /** | 494 /** |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 * (1) [other] is a mirror of the same kind | 556 * (1) [other] is a mirror of the same kind |
581 * and | 557 * and |
582 * (2) The library being reflected by this mirror | 558 * (2) The library being reflected by this mirror |
583 * and the library being reflected by [other] | 559 * and the library being reflected by [other] |
584 * are | 560 * are |
585 * the same library in the same isolate. | 561 * the same library in the same isolate. |
586 */ | 562 */ |
587 bool operator ==(other); | 563 bool operator ==(other); |
588 | 564 |
589 /** | 565 /** |
590 * If [:declarations[name]:] is a regular method m, the result of this method | |
591 * is a closure equivalent to: | |
592 * | |
593 * (r1, ..., rn, {p1: d1, ..., pk: dk}) { | |
594 * return this.invoke(name, [r1, ..., rn], {#p1: p1, ..., #pk: pk}); | |
595 * } | |
596 * | |
597 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk | |
598 * with defaults d1, ..., dk. The result of this method is a | |
599 * closure equivalent to: | |
600 * | |
601 * (r1, ..., rn, [p1 = d1, ..., pk = dk]) { | |
602 * return this.invoke(name, [r1, ..., rn, p1, ..., pk]); | |
603 * } | |
604 * | |
605 * if m has required parameters r1, ..., rn, and optional positional | |
606 * parameters p1, ..., pk with defaults d1, ..., dk. Otherwise, an | |
607 * [ArgumentError] is thrown. | |
608 */ | |
609 Function operator [](Symbol name); | |
610 | |
611 /** | |
612 * Returns a list of the imports and exports in this library; | 566 * Returns a list of the imports and exports in this library; |
613 */ | 567 */ |
614 List<LibraryDependencyMirror> get libraryDependencies; | 568 List<LibraryDependencyMirror> get libraryDependencies; |
615 } | 569 } |
616 | 570 |
617 /// A mirror on an import or export declaration. | 571 /// A mirror on an import or export declaration. |
618 abstract class LibraryDependencyMirror { | 572 abstract class LibraryDependencyMirror { |
619 /// Is `true` if this dependency is an import. | 573 /// Is `true` if this dependency is an import. |
620 bool get isImport; | 574 bool get isImport; |
621 | 575 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 * and | 804 * and |
851 * (2) This mirror and [other] reflect the same class. | 805 * (2) This mirror and [other] reflect the same class. |
852 * | 806 * |
853 * Note that if the reflected class is an invocation of | 807 * Note that if the reflected class is an invocation of |
854 * a generic class,(2) implies that the reflected class | 808 * a generic class,(2) implies that the reflected class |
855 * and [other] have equal type arguments. | 809 * and [other] have equal type arguments. |
856 */ | 810 */ |
857 bool operator == (other); | 811 bool operator == (other); |
858 | 812 |
859 /** | 813 /** |
860 * If [:declarations[name]:] is a regular method m, the result of this method | |
861 * is a closure equivalent to: | |
862 * | |
863 * (r1, ..., rn, {p1: d1, ..., pk: dk}) { | |
864 * return this.invoke(name, [r1, ..., rn], {#p1: p1, ..., #pk: pk}); | |
865 * } | |
866 * | |
867 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk | |
868 * with defaults d1, ..., dk. The result of this method is a | |
869 * closure equivalent to: | |
870 * | |
871 * (r1, ..., rn, [p1 = d1, ..., pk = dk]) { | |
872 * return this.invoke(name, [r1, ..., rn, p1, ..., pk]); | |
873 * } | |
874 * | |
875 * if m has required parameters r1, ..., rn, and optional positional | |
876 * parameters p1, ..., pk with defaults d1, ..., dk. Otherwise, an | |
877 * [ArgumentError] is thrown. | |
878 */ | |
879 Function operator [](Symbol name); | |
880 | |
881 /** | |
882 * Returns whether the class denoted by the receiver is a subclass of the | 814 * Returns whether the class denoted by the receiver is a subclass of the |
883 * class denoted by the argument. | 815 * class denoted by the argument. |
884 * | 816 * |
885 * Note that the subclass relationship is reflexive. | 817 * Note that the subclass relationship is reflexive. |
886 */ | 818 */ |
887 bool isSubclassOf(ClassMirror other); | 819 bool isSubclassOf(ClassMirror other); |
888 } | 820 } |
889 | 821 |
890 /** | 822 /** |
891 * A [FunctionTypeMirror] represents the type of a function in the | 823 * A [FunctionTypeMirror] represents the type of a function in the |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 * | 1204 * |
1273 * When used as metadata on an import of "dart:mirrors", this metadata does | 1205 * When used as metadata on an import of "dart:mirrors", this metadata does |
1274 * not apply to the library in which the annotation is used, but instead | 1206 * not apply to the library in which the annotation is used, but instead |
1275 * applies to the other libraries (all libraries if "*" is used). | 1207 * applies to the other libraries (all libraries if "*" is used). |
1276 */ | 1208 */ |
1277 final override; | 1209 final override; |
1278 | 1210 |
1279 const MirrorsUsed( | 1211 const MirrorsUsed( |
1280 {this.symbols, this.targets, this.metaTargets, this.override}); | 1212 {this.symbols, this.targets, this.metaTargets, this.override}); |
1281 } | 1213 } |
OLD | NEW |