Chromium Code Reviews| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 /** | 472 /** |
| 473 * A mirror on the type of the reflectee. | 473 * A mirror on the type of the reflectee. |
| 474 * | 474 * |
| 475 * Returns a mirror on the actual class of the reflectee. | 475 * Returns a mirror on the actual class of the reflectee. |
| 476 * The class of the reflectee may differ from | 476 * The class of the reflectee may differ from |
| 477 * the object returned by invoking [runtimeType] on | 477 * the object returned by invoking [runtimeType] on |
| 478 * the reflectee. | 478 * the reflectee. |
| 479 */ | 479 */ |
| 480 ClassMirror get type; | 480 ClassMirror get type; |
| 481 | 481 |
| 482 /** | 482 /// Does [reflectee] contain the instance reflected by this mirror? |
|
Lasse Reichstein Nielsen
2015/10/07 08:27:55
Reword to not be a question. And it's not entirely
srawlins
2015/10/07 10:50:51
Done.
| |
| 483 * Does [reflectee] contain the instance reflected by this mirror? | 483 /// |
| 484 * This will always be true in the local case (reflecting instances | 484 /// This will always be true in the local case (reflecting instances in the |
| 485 * in the same isolate), but only true in the remote case if this | 485 /// same isolate), but only true in the remote case if this mirror reflects a |
| 486 * mirror reflects a simple value. | 486 /// simple value. |
| 487 * | 487 /// |
| 488 * A value is simple if one of the following holds: | 488 /// A value is simple if one of the following holds: |
| 489 * - the value is [:null:] | 489 /// |
| 490 * - the value is of type [num] | 490 /// * the value is [:null:] |
| 491 * - the value is of type [bool] | 491 /// * the value is of type [num] |
| 492 * - the value is of type [String] | 492 /// * the value is of type [bool] |
| 493 */ | 493 /// * the value is of type [String] |
| 494 bool get hasReflectee; | 494 bool get hasReflectee; |
| 495 | 495 |
| 496 /** | 496 /** |
| 497 * If the [InstanceMirror] reflects an instance it is meaningful to | 497 * If the [InstanceMirror] reflects an instance it is meaningful to |
| 498 * have a local reference to, we provide access to the actual | 498 * have a local reference to, we provide access to the actual |
| 499 * instance here. | 499 * instance here. |
| 500 * | 500 * |
| 501 * If you access [reflectee] when [hasReflectee] is false, an | 501 * If you access [reflectee] when [hasReflectee] is false, an |
| 502 * exception is thrown. | 502 * exception is thrown. |
| 503 */ | 503 */ |
| 504 get reflectee; | 504 get reflectee; |
| 505 | 505 |
| 506 /** | 506 /// Returns true if this mirror is equal to [other]. |
| 507 * Returns true if this mirror is equal to [other]. | 507 /// |
| 508 * The equality holds if and only if | 508 /// The equality holds if and only if |
| 509 * (1) [other] is a mirror of the same kind | 509 /// |
| 510 * and | 510 /// 1. [other] is a mirror of the same kind, and |
| 511 * (2) either | 511 /// 2. either |
| 512 * (a) [hasReflectee] is true and so is | 512 /// |
| 513 * [:identical(reflectee, other.reflectee):] | 513 /// a. [hasReflectee] is true and so is |
| 514 * or | 514 /// [:identical(reflectee, other.reflectee):], or |
| 515 * (b) the remote objects reflected by this mirror and | 515 /// |
| 516 * by [other] are identical. | 516 /// b. the remote objects reflected by this mirror and by [other] are |
| 517 */ | 517 /// identical. |
| 518 bool operator == (other); | 518 bool operator == (other); |
| 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 { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 539 * [:type.declarations[#call]:]. But the Dart language model does not require | 539 * [:type.declarations[#call]:]. But the Dart language model does not require |
| 540 * this. A more typical implementation involves a single closure class for | 540 * this. A more typical implementation involves a single closure class for |
| 541 * each type signature, where the call method dispatches to a function held | 541 * each type signature, where the call method dispatches to a function held |
| 542 * in the closure rather the call method | 542 * in the closure rather the call method |
| 543 * directly implementing the closure body. So one cannot rely on closures from | 543 * directly implementing the closure body. So one cannot rely on closures from |
| 544 * distinct closure expressions having distinct classes ([:type:]), but one | 544 * distinct closure expressions having distinct classes ([:type:]), but one |
| 545 * can rely on them having distinct functions ([:function:]). | 545 * can rely on them having distinct functions ([:function:]). |
| 546 */ | 546 */ |
| 547 MethodMirror get function; | 547 MethodMirror get function; |
| 548 | 548 |
| 549 /** | 549 /// Executes the closure and returns a mirror on the result. |
| 550 * Executes the closure and returns a mirror on the result. | 550 /// |
| 551 * Let *f* be the closure reflected by this mirror, | 551 /// Let *f* be the closure reflected by this mirror, let *a1, ..., an* be the |
| 552 * let *a1, ..., an* be the elements of [positionalArguments] | 552 /// elements of [positionalArguments], let *k1, ..., km* be the identifiers |
| 553 * let *k1, ..., km* be the identifiers denoted by the elements of | 553 /// denoted by the elements of [namedArguments.keys], and let *v1, ..., vm* be |
| 554 * [namedArguments.keys] | 554 /// the elements of [namedArguments.values]. Then this method will perform the |
| 555 * and let *v1, ..., vm* be the elements of [namedArguments.values]. | 555 /// method invocation *f(a1, ..., an, k1: v1, ..., km: vm)* |
|
Lasse Reichstein Nielsen
2015/10/07 08:27:55
The line breaking of the original was actually ver
srawlins
2015/10/07 10:50:51
Done.
| |
| 556 * Then this method will perform the method invocation | 556 /// |
| 557 * *f(a1, ..., an, k1: v1, ..., km: vm)* | 557 /// If the invocation returns a result *r*, this method returns the result of |
| 558 * If the invocation returns a result *r*, this method returns | 558 /// calling [reflect]\(*r*\). |
| 559 * the result of calling [reflect]\(*r*\). | 559 /// |
| 560 * If the invocation causes a compilation error | 560 /// If the invocation causes a compilation error, the effect is the same as if |
| 561 * the effect is the same as if a non-reflective compilation error | 561 /// a non-reflective compilation error had been encountered. |
| 562 * had been encountered. | 562 /// |
| 563 * If the invocation throws an exception *e* (that it does not catch) | 563 /// If the invocation throws an exception *e* (that it does not catch), this |
| 564 * this method throws *e*. | 564 /// method throws *e*. |
| 565 */ | |
| 566 InstanceMirror apply(List positionalArguments, | 565 InstanceMirror apply(List positionalArguments, |
| 567 [Map<Symbol, dynamic> namedArguments]); | 566 [Map<Symbol, dynamic> namedArguments]); |
| 568 } | 567 } |
| 569 | 568 |
| 570 /** | 569 /** |
| 571 * A [LibraryMirror] reflects a Dart language library, providing | 570 * A [LibraryMirror] reflects a Dart language library, providing |
| 572 * access to the variables, functions, and classes of the | 571 * access to the variables, functions, and classes of the |
| 573 * library. | 572 * library. |
| 574 */ | 573 */ |
| 575 abstract class LibraryMirror implements DeclarationMirror, ObjectMirror { | 574 abstract class LibraryMirror implements DeclarationMirror, ObjectMirror { |
| 576 /** | 575 /** |
| 577 * The absolute uri of the library. | 576 * The absolute uri of the library. |
| 578 */ | 577 */ |
| 579 Uri get uri; | 578 Uri get uri; |
| 580 | 579 |
| 581 /** | 580 /** |
| 582 * Returns an immutable map of the declarations actually given in the library. | 581 * Returns an immutable map of the declarations actually given in the library. |
| 583 * | 582 * |
| 584 * This map includes all regular methods, getters, setters, fields, classes | 583 * This map includes all regular methods, getters, setters, fields, classes |
| 585 * and typedefs actually declared in the library. The map is keyed by the | 584 * and typedefs actually declared in the library. The map is keyed by the |
| 586 * simple names of the declarations. | 585 * simple names of the declarations. |
| 587 */ | 586 */ |
| 588 Map<Symbol, DeclarationMirror> get declarations; | 587 Map<Symbol, DeclarationMirror> get declarations; |
| 589 | 588 |
| 590 /** | 589 /// Returns [:true:] if this mirror is equal to [other]. |
| 591 * Returns [:true:] if this mirror is equal to [other]. | 590 /// |
| 592 * Otherwise returns [:false:]. | 591 /// Otherwise returns [:false:]. |
| 593 * | 592 /// |
| 594 * The equality holds if and only if | 593 /// The equality holds if and only if |
| 595 * (1) [other] is a mirror of the same kind | 594 /// |
| 596 * and | 595 /// 1. [other] is a mirror of the same kind, and |
| 597 * (2) The library being reflected by this mirror | 596 /// 2. The library being reflected by this mirror and the library being |
| 598 * and the library being reflected by [other] | 597 /// reflected by [other] are the same library in the same isolate. |
| 599 * are | |
| 600 * the same library in the same isolate. | |
| 601 */ | |
| 602 bool operator ==(other); | 598 bool operator ==(other); |
| 603 | 599 |
| 604 /** | 600 /** |
| 605 * Returns a list of the imports and exports in this library; | 601 * Returns a list of the imports and exports in this library; |
| 606 */ | 602 */ |
| 607 List<LibraryDependencyMirror> get libraryDependencies; | 603 List<LibraryDependencyMirror> get libraryDependencies; |
| 608 } | 604 } |
| 609 | 605 |
| 610 /// A mirror on an import or export declaration. | 606 /// A mirror on an import or export declaration. |
| 611 abstract class LibraryDependencyMirror implements Mirror { | 607 abstract class LibraryDependencyMirror implements Mirror { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 * | 714 * |
| 719 * For most classes, they are their own original declaration. For | 715 * For most classes, they are their own original declaration. For |
| 720 * generic classes, however, there is a distinction between the | 716 * generic classes, however, there is a distinction between the |
| 721 * original class declaration, which has unbound type variables, and | 717 * original class declaration, which has unbound type variables, and |
| 722 * the instantiations of generic classes, which have bound type | 718 * the instantiations of generic classes, which have bound type |
| 723 * variables. | 719 * variables. |
| 724 */ | 720 */ |
| 725 TypeMirror get originalDeclaration; | 721 TypeMirror get originalDeclaration; |
| 726 | 722 |
| 727 | 723 |
| 728 /** | 724 /// Checks the subtype relationship, denoted by [:<::] in the language |
|
Lasse Reichstein Nielsen
2015/10/07 08:27:55
You can change [:...:] to `...` too, while you are
srawlins
2015/10/07 10:50:51
Done.
| |
| 729 * Checks the subtype relationship, denoted by [:<::] in the language | 725 /// specification. |
| 730 * specification. This is the type relationship used in [:is:] test checks. | 726 /// |
| 731 */ | 727 /// This is the type relationship used in [:is:] test checks. |
| 732 bool isSubtypeOf(TypeMirror other); | 728 bool isSubtypeOf(TypeMirror other); |
| 733 | 729 |
| 734 /** | 730 /// Checks the assignability relationship, denoted by [:<=>:] in the language |
| 735 * Checks the assignability relationship, denoted by [:<=>:] in the language | 731 /// specification. |
| 736 * specification. This is the type relationship tested on assignment in | 732 /// |
| 737 * checked mode. | 733 /// This is the type relationship tested on assignment in checked mode. |
| 738 */ | |
| 739 bool isAssignableTo(TypeMirror other); | 734 bool isAssignableTo(TypeMirror other); |
| 740 } | 735 } |
| 741 | 736 |
| 742 /** | 737 /** |
| 743 * A [ClassMirror] reflects a Dart language class. | 738 * A [ClassMirror] reflects a Dart language class. |
| 744 */ | 739 */ |
| 745 abstract class ClassMirror implements TypeMirror, ObjectMirror { | 740 abstract class ClassMirror implements TypeMirror, ObjectMirror { |
| 746 /** | 741 /** |
| 747 * A mirror on the superclass on the reflectee. | 742 * A mirror on the superclass on the reflectee. |
| 748 * | 743 * |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 797 * | 792 * |
| 798 * The intent is to capture those members that constitute the API of a class. | 793 * The intent is to capture those members that constitute the API of a class. |
| 799 * Hence fields are not included, but the getters and setters implicitly | 794 * Hence fields are not included, but the getters and setters implicitly |
| 800 * introduced by fields are included. | 795 * introduced by fields are included. |
| 801 * | 796 * |
| 802 * The map is keyed by the simple names of the members. | 797 * The map is keyed by the simple names of the members. |
| 803 */ | 798 */ |
| 804 Map<Symbol, MethodMirror> get staticMembers; | 799 Map<Symbol, MethodMirror> get staticMembers; |
| 805 | 800 |
| 806 | 801 |
| 807 /** | 802 /// The mixin of this class. |
| 808 * The mixin of this class. | 803 /// |
| 809 * If this class is the result of a mixin application of the | 804 /// If this class is the result of a mixin application of the form S with M, |
| 810 * form S with M, returns a class mirror on M. | 805 /// returns a class mirror on M. Otherwise returns a class mirror on |
| 811 * Otherwise returns a class mirror on [reflectee]. | 806 /// [reflectee]. |
| 812 */ | |
| 813 ClassMirror get mixin; | 807 ClassMirror get mixin; |
| 814 | 808 |
| 815 // TODO(ahe): What about: | 809 // TODO(ahe): What about: |
| 816 // /// Finds the instance member named [name] declared or inherited in the | 810 // /// Finds the instance member named [name] declared or inherited in the |
| 817 // /// reflected class. | 811 // /// reflected class. |
| 818 // DeclarationMirror instanceLookup(Symbol name); | 812 // DeclarationMirror instanceLookup(Symbol name); |
| 819 | 813 |
| 820 /** | 814 /// Invokes the named constructor and returns a mirror on the result. |
| 821 * Invokes the named constructor and returns a mirror on the result. | 815 /// |
| 822 * | 816 /// Let *c* be the class reflected by this mirror, let *a1, ..., an* be the |
| 823 * Let *c* be the class reflected by this mirror | 817 /// elements of [positionalArguments], let *k1, ..., km* be the identifiers |
| 824 * let *a1, ..., an* be the elements of [positionalArguments] | 818 /// denoted by the elements of [namedArguments.keys], and let *v1, ..., vm* |
| 825 * let *k1, ..., km* be the identifiers denoted by the elements of | 819 /// be the elements of [namedArguments.values]. |
|
Lasse Reichstein Nielsen
2015/10/07 08:27:55
Again a reflow that makes reading/editing harder.
srawlins
2015/10/07 10:50:51
Done.
| |
| 826 * [namedArguments.keys] | 820 /// |
| 827 * and let *v1, ..., vm* be the elements of [namedArguments.values]. | 821 /// If [constructorName] was created from the empty string, then this method |
| 828 * If [constructorName] was created from the empty string | 822 /// will execute the instance creation expression |
| 829 * Then this method will execute the instance creation expression | 823 /// *new c(a1, ..., an, k1: v1, ..., km: vm)* in a scope that has access to |
| 830 * *new c(a1, ..., an, k1: v1, ..., km: vm)* | 824 /// the private members of *c*. |
| 831 * in a scope that has access to the private members | 825 /// |
| 832 * of *c*. Otherwise, let | 826 /// Otherwise, let *f* be the simple name of the constructor denoted by |
| 833 * *f* be the simple name of the constructor denoted by [constructorName] | 827 /// [constructorName]. Then this method will execute the instance creation |
| 834 * Then this method will execute the instance creation expression | 828 /// expression *new c.f(a1, ..., an, k1: v1, ..., km: vm)* in a scope that has |
| 835 * *new c.f(a1, ..., an, k1: v1, ..., km: vm)* | 829 /// access to the private members of *c*. |
| 836 * in a scope that has access to the private members | 830 /// |
| 837 * of *c*. | 831 /// In either case: |
| 838 * In either case: | 832 /// |
| 839 * If the expression evaluates to a result *r*, this method returns | 833 /// * If the expression evaluates to a result *r*, this method returns the |
| 840 * the result of calling [reflect]\(*r*\). | 834 /// result of calling [reflect]\(*r*\). |
| 841 * If evaluating the expression causes a compilation error | 835 /// * If evaluating the expression causes a compilation error, the effect is |
| 842 * the effect is the same as if a non-reflective compilation error | 836 /// the same as if a non-reflective compilation error had been encountered. |
| 843 * had been encountered. | 837 /// * If evaluating the expression throws an exception *e* (that it does not |
| 844 * If evaluating the expression throws an exception *e* | 838 /// catch), this method throws *e*. |
| 845 * (that it does not catch) | |
| 846 * this method throws *e*. | |
| 847 */ | |
| 848 InstanceMirror newInstance(Symbol constructorName, | 839 InstanceMirror newInstance(Symbol constructorName, |
| 849 List positionalArguments, | 840 List positionalArguments, |
| 850 [Map<Symbol,dynamic> namedArguments]); | 841 [Map<Symbol,dynamic> namedArguments]); |
| 851 | 842 |
| 852 /** | 843 /// Returns [:true:] if this mirror is equal to [other]. |
| 853 * Returns [:true:] if this mirror is equal to [other]. | 844 /// |
| 854 * Otherwise returns [:false:]. | 845 /// Otherwise returns [:false:]. |
|
Lasse Reichstein Nielsen
2015/10/07 08:27:55
Maybe replace by:
"Whether [other] is a [ClassMirr
srawlins
2015/10/07 10:50:51
Done.
| |
| 855 * | 846 /// |
| 856 * The equality holds if and only if | 847 /// The equality holds if and only if |
| 857 * (1) [other] is a mirror of the same kind | 848 /// |
| 858 * and | 849 /// 1. [other] is a mirror of the same kind, and |
| 859 * (2) This mirror and [other] reflect the same class. | 850 /// 2. This mirror and [other] reflect the same class. |
| 860 * | 851 /// |
| 861 * Note that if the reflected class is an invocation of | 852 /// Note that if the reflected class is an invocation of a generic class, 2. |
| 862 * a generic class,(2) implies that the reflected class | 853 /// implies that the reflected class and [other] have equal type arguments. |
| 863 * and [other] have equal type arguments. | |
| 864 */ | |
| 865 bool operator == (other); | 854 bool operator == (other); |
| 866 | 855 |
| 867 /** | 856 /** |
| 868 * Returns whether the class denoted by the receiver is a subclass of the | 857 * Returns whether the class denoted by the receiver is a subclass of the |
| 869 * class denoted by the argument. | 858 * class denoted by the argument. |
| 870 * | 859 * |
| 871 * Note that the subclass relationship is reflexive. | 860 * Note that the subclass relationship is reflexive. |
| 872 */ | 861 */ |
| 873 bool isSubclassOf(ClassMirror other); | 862 bool isSubclassOf(ClassMirror other); |
| 874 } | 863 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 889 List<ParameterMirror> get parameters; | 878 List<ParameterMirror> get parameters; |
| 890 | 879 |
| 891 /** | 880 /** |
| 892 * A mirror on the [:call:] method for the reflectee. | 881 * A mirror on the [:call:] method for the reflectee. |
| 893 */ | 882 */ |
| 894 // This is only here because in the past the VM did not implement a call | 883 // This is only here because in the past the VM did not implement a call |
| 895 // method on closures. | 884 // method on closures. |
| 896 MethodMirror get callMethod; | 885 MethodMirror get callMethod; |
| 897 } | 886 } |
| 898 | 887 |
| 899 /** | 888 /// A [TypeVariableMirror] represents a type parameter of a generic type. |
| 900 * A [TypeVariableMirror] represents a type parameter of a generic | |
| 901 * type. | |
| 902 */ | |
| 903 abstract class TypeVariableMirror extends TypeMirror { | 889 abstract class TypeVariableMirror extends TypeMirror { |
| 904 /** | 890 /** |
| 905 * A mirror on the type that is the upper bound of this type variable. | 891 * A mirror on the type that is the upper bound of this type variable. |
| 906 */ | 892 */ |
| 907 TypeMirror get upperBound; | 893 TypeMirror get upperBound; |
| 908 | 894 |
| 909 /** | 895 /** |
| 910 * Is the reflectee static? | 896 * Is the reflectee static? |
| 911 * | 897 * |
| 912 * For the purposes of the mirrors library, type variables are considered | 898 * For the purposes of the mirrors library, type variables are considered |
| 913 * non-static. | 899 * non-static. |
| 914 */ | 900 */ |
| 915 bool get isStatic; | 901 bool get isStatic; |
| 916 | 902 |
| 917 /** | 903 /// Returns [:true:] if this mirror is equal to [other]. |
| 918 * Returns [:true:] if this mirror is equal to [other]. | 904 /// |
| 919 * Otherwise returns [:false:]. | 905 /// Otherwise returns [:false:]. |
|
Lasse Reichstein Nielsen
2015/10/07 08:27:55
Again, maybe change to "Whether [other] is a [Type
srawlins
2015/10/07 10:50:51
Done.
| |
| 920 * | 906 /// |
| 921 * The equality holds if and only if | 907 /// The equality holds if and only if |
| 922 * (1) [other] is a mirror of the same kind | 908 /// |
| 923 * and | 909 /// 1. [other] is a mirror of the same kind, and |
| 924 * (2) [:simpleName == other.simpleName:] and | 910 /// 2. [:simpleName == other.simpleName:] and [:owner == other.owner:]. |
| 925 * [:owner == other.owner:]. | 911 bool operator == (other); |
| 926 */ | |
| 927 bool operator == (other); | |
| 928 } | 912 } |
| 929 | 913 |
| 930 /** | 914 /** |
| 931 * A [TypedefMirror] represents a typedef in a Dart language program. | 915 * A [TypedefMirror] represents a typedef in a Dart language program. |
| 932 */ | 916 */ |
| 933 abstract class TypedefMirror implements TypeMirror { | 917 abstract class TypedefMirror implements TypeMirror { |
| 934 /** | 918 /// The defining type for this typedef. |
| 935 * The defining type for this typedef. | 919 /// |
| 936 * If the the type referred to by the reflectee is a function type | 920 /// If the the type referred to by the reflectee is a function type *F*, the |
| 937 * *F*, the result will be [:FunctionTypeMirror:] reflecting *F* | 921 /// result will be [:FunctionTypeMirror:] reflecting *F* which is abstract |
| 938 * which is abstract and has an abstract method [:call:] whose | 922 /// and has an abstract method [:call:] whose signature corresponds to *F*. |
| 939 * signature corresponds to *F*. | 923 /// For instance [:void f(int):] is the referent for [:typedef void f(int):]. |
| 940 * | |
| 941 * For instance [:void f(int):] is the referent for [:typedef void f(int):]. | |
| 942 */ | |
| 943 FunctionTypeMirror get referent; | 924 FunctionTypeMirror get referent; |
| 944 } | 925 } |
| 945 | 926 |
| 946 /** | 927 /** |
| 947 * A [MethodMirror] reflects a Dart language function, method, | 928 * A [MethodMirror] reflects a Dart language function, method, |
| 948 * constructor, getter, or setter. | 929 * constructor, getter, or setter. |
| 949 */ | 930 */ |
| 950 abstract class MethodMirror implements DeclarationMirror { | 931 abstract class MethodMirror implements DeclarationMirror { |
| 951 /** | 932 /** |
| 952 * A mirror on the return type for the reflectee. | 933 * A mirror on the return type for the reflectee. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1038 /** | 1019 /** |
| 1039 * Is the reflectee a redirecting constructor? | 1020 * Is the reflectee a redirecting constructor? |
| 1040 */ | 1021 */ |
| 1041 bool get isRedirectingConstructor; | 1022 bool get isRedirectingConstructor; |
| 1042 | 1023 |
| 1043 /** | 1024 /** |
| 1044 * Is the reflectee a factory constructor? | 1025 * Is the reflectee a factory constructor? |
| 1045 */ | 1026 */ |
| 1046 bool get isFactoryConstructor; | 1027 bool get isFactoryConstructor; |
| 1047 | 1028 |
| 1048 /** | 1029 /// Returns true if this mirror is equal to [other]. |
| 1049 * Returns true if this mirror is equal to [other]. | 1030 /// |
| 1050 * | 1031 /// The equality holds if and only if |
| 1051 * The equality holds if and only if | 1032 /// |
| 1052 * (1) [other] is a mirror of the same kind | 1033 /// 1. [other] is a mirror of the same kind, and |
| 1053 * and | 1034 /// 2. [:simpleName == other.simpleName:] and [:owner == other.owner:]. |
| 1054 * (2) [:simpleName == other.simpleName:] and | |
| 1055 * [:owner == other.owner:]. | |
| 1056 */ | |
| 1057 bool operator == (other); | 1035 bool operator == (other); |
| 1058 } | 1036 } |
| 1059 | 1037 |
| 1060 /** | 1038 /** |
| 1061 * A [VariableMirror] reflects a Dart language variable declaration. | 1039 * A [VariableMirror] reflects a Dart language variable declaration. |
| 1062 */ | 1040 */ |
| 1063 abstract class VariableMirror implements DeclarationMirror { | 1041 abstract class VariableMirror implements DeclarationMirror { |
| 1064 /** | 1042 /** |
| 1065 * Returns a mirror on the type of the reflectee. | 1043 * Returns a mirror on the type of the reflectee. |
| 1066 */ | 1044 */ |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1080 * Otherwise returns [:false:]. | 1058 * Otherwise returns [:false:]. |
| 1081 */ | 1059 */ |
| 1082 bool get isFinal; | 1060 bool get isFinal; |
| 1083 | 1061 |
| 1084 /** | 1062 /** |
| 1085 * Returns [:true:] if the reflectee is declared [:const:]. | 1063 * Returns [:true:] if the reflectee is declared [:const:]. |
| 1086 * Otherwise returns [:false:]. | 1064 * Otherwise returns [:false:]. |
| 1087 */ | 1065 */ |
| 1088 bool get isConst; | 1066 bool get isConst; |
| 1089 | 1067 |
| 1090 /** | 1068 /// Returns true if this mirror is equal to [other]. |
| 1091 * Returns true if this mirror is equal to [other]. | 1069 /// |
| 1092 * | 1070 /// The equality holds if and only if |
| 1093 * The equality holds if and only if | 1071 /// |
| 1094 * (1) [other] is a mirror of the same kind | 1072 /// 1. [other] is a mirror of the same kind, and |
| 1095 * and | 1073 /// 2. [:simpleName == other.simpleName:] and [:owner == other.owner:]. |
| 1096 * (2) [:simpleName == other.simpleName:] and | 1074 bool operator == (other); |
| 1097 * [:owner == other.owner:]. | |
| 1098 */ | |
| 1099 bool operator == (other); | |
| 1100 } | 1075 } |
| 1101 | 1076 |
| 1102 /** | 1077 /** |
| 1103 * A [ParameterMirror] reflects a Dart formal parameter declaration. | 1078 * A [ParameterMirror] reflects a Dart formal parameter declaration. |
| 1104 */ | 1079 */ |
| 1105 abstract class ParameterMirror implements VariableMirror { | 1080 abstract class ParameterMirror implements VariableMirror { |
| 1106 /** | 1081 /** |
| 1107 * A mirror on the type of this parameter. | 1082 * A mirror on the type of this parameter. |
| 1108 */ | 1083 */ |
| 1109 TypeMirror get type; | 1084 TypeMirror get type; |
| 1110 | 1085 |
| 1111 /** | 1086 /** |
| 1112 * Returns [:true:] if the reflectee is an optional parameter. | 1087 * Returns [:true:] if the reflectee is an optional parameter. |
| 1113 * Otherwise returns [:false:]. | 1088 * Otherwise returns [:false:]. |
| 1114 */ | 1089 */ |
| 1115 bool get isOptional; | 1090 bool get isOptional; |
| 1116 | 1091 |
| 1117 /** | 1092 /** |
| 1118 * Returns [:true:] if the reflectee is a named parameter. | 1093 * Returns [:true:] if the reflectee is a named parameter. |
| 1119 * Otherwise returns [:false:]. | 1094 * Otherwise returns [:false:]. |
| 1120 */ | 1095 */ |
| 1121 bool get isNamed; | 1096 bool get isNamed; |
| 1122 | 1097 |
| 1123 /** | 1098 /** |
| 1124 * Returns [:true:] if the reflectee has explicitly declared a default value. | 1099 * Returns [:true:] if the reflectee has explicitly declared a default value. |
| 1125 * Otherwise returns [:false:]. | 1100 * Otherwise returns [:false:]. |
| 1126 */ | 1101 */ |
| 1127 bool get hasDefaultValue; | 1102 bool get hasDefaultValue; |
| 1128 | 1103 |
| 1129 /** | 1104 /// If this is a required parameter, returns [:null:]. |
|
Lasse Reichstein Nielsen
2015/10/07 08:27:55
Start by describing what it is/does, leave excepti
srawlins
2015/10/07 10:50:51
Done.
| |
| 1130 * If this is a required parameter, returns [:null:]. Otherwise returns a | 1105 /// |
| 1131 * mirror on the default value for this parameter. If no default is declared | 1106 /// Otherwise returns a mirror on the default value for this parameter. If no |
| 1132 * for an optional parameter, the default is [:null:] and a mirror on [:null:] | 1107 /// default is declared for an optional parameter, the default is [:null:] and |
| 1133 * is returned. | 1108 /// a mirror on [:null:] is returned. |
| 1134 */ | |
| 1135 InstanceMirror get defaultValue; | 1109 InstanceMirror get defaultValue; |
| 1136 } | 1110 } |
| 1137 | 1111 |
| 1138 /** | 1112 /** |
| 1139 * A [SourceLocation] describes the span of an entity in Dart source code. | 1113 * A [SourceLocation] describes the span of an entity in Dart source code. |
| 1140 */ | 1114 */ |
| 1141 abstract class SourceLocation { | 1115 abstract class SourceLocation { |
| 1142 /** | 1116 /** |
| 1143 * The 1-based line number for this source location. | 1117 * The 1-based line number for this source location. |
| 1144 * | 1118 * |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1430 final override; | 1404 final override; |
| 1431 | 1405 |
| 1432 /** | 1406 /** |
| 1433 * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets], | 1407 * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets], |
| 1434 * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation | 1408 * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation |
| 1435 * of the parameters. | 1409 * of the parameters. |
| 1436 */ | 1410 */ |
| 1437 const MirrorsUsed( | 1411 const MirrorsUsed( |
| 1438 {this.symbols, this.targets, this.metaTargets, this.override}); | 1412 {this.symbols, this.targets, this.metaTargets, this.override}); |
| 1439 } | 1413 } |
| OLD | NEW |