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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 /** |
483 * Does [reflectee] contain the instance reflected by this mirror? | 483 * Whether [reflectee] will return the instance reflected by this mirror. |
484 * This will always be true in the local case (reflecting instances | 484 * |
485 * in the same isolate), but only true in the remote case if this | 485 * This will always be true in the local case (reflecting instances in the |
486 * mirror reflects a simple value. | 486 * same isolate), but only true in the remote case if this mirror reflects a |
| 487 * simple value. |
487 * | 488 * |
488 * A value is simple if one of the following holds: | 489 * A value is simple if one of the following holds: |
489 * - the value is [:null:] | 490 * |
490 * - the value is of type [num] | 491 * * the value is [:null:] |
491 * - the value is of type [bool] | 492 * * the value is of type [num] |
492 * - the value is of type [String] | 493 * * the value is of type [bool] |
| 494 * * the value is of type [String] |
493 */ | 495 */ |
494 bool get hasReflectee; | 496 bool get hasReflectee; |
495 | 497 |
496 /** | 498 /** |
497 * If the [InstanceMirror] reflects an instance it is meaningful to | 499 * If the [InstanceMirror] reflects an instance it is meaningful to |
498 * have a local reference to, we provide access to the actual | 500 * have a local reference to, we provide access to the actual |
499 * instance here. | 501 * instance here. |
500 * | 502 * |
501 * If you access [reflectee] when [hasReflectee] is false, an | 503 * If you access [reflectee] when [hasReflectee] is false, an |
502 * exception is thrown. | 504 * exception is thrown. |
503 */ | 505 */ |
504 get reflectee; | 506 get reflectee; |
505 | 507 |
506 /** | 508 /** |
507 * Returns true if this mirror is equal to [other]. | 509 * Whether this mirror is equal to [other]. |
| 510 * |
508 * The equality holds if and only if | 511 * The equality holds if and only if |
509 * (1) [other] is a mirror of the same kind | 512 * |
510 * and | 513 * 1. [other] is a mirror of the same kind, and |
511 * (2) either | 514 * 2. either |
512 * (a) [hasReflectee] is true and so is | 515 * |
513 * [:identical(reflectee, other.reflectee):] | 516 * a. [hasReflectee] is true and so is |
514 * or | 517 * [:identical(reflectee, other.reflectee):], or |
515 * (b) the remote objects reflected by this mirror and | 518 * |
516 * by [other] are identical. | 519 * b. the remote objects reflected by this mirror and by [other] are |
| 520 * identical. |
517 */ | 521 */ |
518 bool operator == (other); | 522 bool operator == (other); |
519 } | 523 } |
520 | 524 |
521 /** | 525 /** |
522 * A [ClosureMirror] reflects a closure. | 526 * A [ClosureMirror] reflects a closure. |
523 * | 527 * |
524 * A [ClosureMirror] provides the ability to execute its reflectee and | 528 * A [ClosureMirror] provides the ability to execute its reflectee and |
525 * introspect its function. | 529 * introspect its function. |
526 */ | 530 */ |
(...skipping 14 matching lines...) Expand all Loading... |
541 * each type signature, where the call method dispatches to a function held | 545 * each type signature, where the call method dispatches to a function held |
542 * in the closure rather the call method | 546 * in the closure rather the call method |
543 * directly implementing the closure body. So one cannot rely on closures from | 547 * directly implementing the closure body. So one cannot rely on closures from |
544 * distinct closure expressions having distinct classes ([:type:]), but one | 548 * distinct closure expressions having distinct classes ([:type:]), but one |
545 * can rely on them having distinct functions ([:function:]). | 549 * can rely on them having distinct functions ([:function:]). |
546 */ | 550 */ |
547 MethodMirror get function; | 551 MethodMirror get function; |
548 | 552 |
549 /** | 553 /** |
550 * Executes the closure and returns a mirror on the result. | 554 * Executes the closure and returns a mirror on the result. |
| 555 * |
551 * Let *f* be the closure reflected by this mirror, | 556 * Let *f* be the closure reflected by this mirror, |
552 * let *a1, ..., an* be the elements of [positionalArguments] | 557 * let *a1, ..., an* be the elements of [positionalArguments], |
553 * let *k1, ..., km* be the identifiers denoted by the elements of | 558 * let *k1, ..., km* be the identifiers denoted by the elements of |
554 * [namedArguments.keys] | 559 * [namedArguments.keys], |
555 * and let *v1, ..., vm* be the elements of [namedArguments.values]. | 560 * and let *v1, ..., vm* be the elements of [namedArguments.values]. |
| 561 * |
556 * Then this method will perform the method invocation | 562 * Then this method will perform the method invocation |
557 * *f(a1, ..., an, k1: v1, ..., km: vm)* | 563 * *f(a1, ..., an, k1: v1, ..., km: vm)*. |
558 * If the invocation returns a result *r*, this method returns | 564 * |
559 * the result of calling [reflect]\(*r*\). | 565 * If the invocation returns a result *r*, this method returns the result of |
560 * If the invocation causes a compilation error | 566 * calling [reflect]\(*r*\). |
561 * the effect is the same as if a non-reflective compilation error | 567 * |
562 * had been encountered. | 568 * If the invocation causes a compilation error, the effect is the same as if |
563 * If the invocation throws an exception *e* (that it does not catch) | 569 * a non-reflective compilation error had been encountered. |
564 * this method throws *e*. | 570 * |
| 571 * If the invocation throws an exception *e* (that it does not catch), this |
| 572 * method throws *e*. |
565 */ | 573 */ |
566 InstanceMirror apply(List positionalArguments, | 574 InstanceMirror apply(List positionalArguments, |
567 [Map<Symbol, dynamic> namedArguments]); | 575 [Map<Symbol, dynamic> namedArguments]); |
568 } | 576 } |
569 | 577 |
570 /** | 578 /** |
571 * A [LibraryMirror] reflects a Dart language library, providing | 579 * A [LibraryMirror] reflects a Dart language library, providing |
572 * access to the variables, functions, and classes of the | 580 * access to the variables, functions, and classes of the |
573 * library. | 581 * library. |
574 */ | 582 */ |
575 abstract class LibraryMirror implements DeclarationMirror, ObjectMirror { | 583 abstract class LibraryMirror implements DeclarationMirror, ObjectMirror { |
576 /** | 584 /** |
577 * The absolute uri of the library. | 585 * The absolute uri of the library. |
578 */ | 586 */ |
579 Uri get uri; | 587 Uri get uri; |
580 | 588 |
581 /** | 589 /** |
582 * Returns an immutable map of the declarations actually given in the library. | 590 * Returns an immutable map of the declarations actually given in the library. |
583 * | 591 * |
584 * This map includes all regular methods, getters, setters, fields, classes | 592 * This map includes all regular methods, getters, setters, fields, classes |
585 * and typedefs actually declared in the library. The map is keyed by the | 593 * and typedefs actually declared in the library. The map is keyed by the |
586 * simple names of the declarations. | 594 * simple names of the declarations. |
587 */ | 595 */ |
588 Map<Symbol, DeclarationMirror> get declarations; | 596 Map<Symbol, DeclarationMirror> get declarations; |
589 | 597 |
590 /** | 598 /** |
591 * Returns [:true:] if this mirror is equal to [other]. | 599 * Whether this mirror is equal to [other]. |
592 * Otherwise returns [:false:]. | |
593 * | 600 * |
594 * The equality holds if and only if | 601 * The equality holds if and only if |
595 * (1) [other] is a mirror of the same kind | 602 * |
596 * and | 603 * 1. [other] is a mirror of the same kind, and |
597 * (2) The library being reflected by this mirror | 604 * 2. The library being reflected by this mirror and the library being |
598 * and the library being reflected by [other] | 605 * reflected by [other] are the same library in the same isolate. |
599 * are | |
600 * the same library in the same isolate. | |
601 */ | 606 */ |
602 bool operator ==(other); | 607 bool operator ==(other); |
603 | 608 |
604 /** | 609 /** |
605 * Returns a list of the imports and exports in this library; | 610 * Returns a list of the imports and exports in this library; |
606 */ | 611 */ |
607 List<LibraryDependencyMirror> get libraryDependencies; | 612 List<LibraryDependencyMirror> get libraryDependencies; |
608 } | 613 } |
609 | 614 |
610 /// A mirror on an import or export declaration. | 615 /// A mirror on an import or export declaration. |
611 abstract class LibraryDependencyMirror implements Mirror { | 616 abstract class LibraryDependencyMirror implements Mirror { |
612 /// Is `true` if this dependency is an import. | 617 /// Is `true` if this dependency is an import. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 * For most classes, they are their own original declaration. For | 724 * For most classes, they are their own original declaration. For |
720 * generic classes, however, there is a distinction between the | 725 * generic classes, however, there is a distinction between the |
721 * original class declaration, which has unbound type variables, and | 726 * original class declaration, which has unbound type variables, and |
722 * the instantiations of generic classes, which have bound type | 727 * the instantiations of generic classes, which have bound type |
723 * variables. | 728 * variables. |
724 */ | 729 */ |
725 TypeMirror get originalDeclaration; | 730 TypeMirror get originalDeclaration; |
726 | 731 |
727 | 732 |
728 /** | 733 /** |
729 * Checks the subtype relationship, denoted by [:<::] in the language | 734 * Checks the subtype relationship, denoted by `<:` in the language |
730 * specification. This is the type relationship used in [:is:] test checks. | 735 * specification. |
| 736 * |
| 737 * This is the type relationship used in `is` test checks. |
731 */ | 738 */ |
732 bool isSubtypeOf(TypeMirror other); | 739 bool isSubtypeOf(TypeMirror other); |
733 | 740 |
734 /** | 741 /** |
735 * Checks the assignability relationship, denoted by [:<=>:] in the language | 742 * Checks the assignability relationship, denoted by `<=>` in the language |
736 * specification. This is the type relationship tested on assignment in | 743 * specification. |
737 * checked mode. | 744 * |
| 745 * This is the type relationship tested on assignment in checked mode. |
738 */ | 746 */ |
739 bool isAssignableTo(TypeMirror other); | 747 bool isAssignableTo(TypeMirror other); |
740 } | 748 } |
741 | 749 |
742 /** | 750 /** |
743 * A [ClassMirror] reflects a Dart language class. | 751 * A [ClassMirror] reflects a Dart language class. |
744 */ | 752 */ |
745 abstract class ClassMirror implements TypeMirror, ObjectMirror { | 753 abstract class ClassMirror implements TypeMirror, ObjectMirror { |
746 /** | 754 /** |
747 * A mirror on the superclass on the reflectee. | 755 * A mirror on the superclass on the reflectee. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 * Hence fields are not included, but the getters and setters implicitly | 807 * Hence fields are not included, but the getters and setters implicitly |
800 * introduced by fields are included. | 808 * introduced by fields are included. |
801 * | 809 * |
802 * The map is keyed by the simple names of the members. | 810 * The map is keyed by the simple names of the members. |
803 */ | 811 */ |
804 Map<Symbol, MethodMirror> get staticMembers; | 812 Map<Symbol, MethodMirror> get staticMembers; |
805 | 813 |
806 | 814 |
807 /** | 815 /** |
808 * The mixin of this class. | 816 * The mixin of this class. |
809 * If this class is the result of a mixin application of the | 817 * |
810 * form S with M, returns a class mirror on M. | 818 * If this class is the result of a mixin application of the form S with M, |
811 * Otherwise returns a class mirror on [reflectee]. | 819 * returns a class mirror on M. Otherwise returns a class mirror on |
| 820 * [reflectee]. |
812 */ | 821 */ |
813 ClassMirror get mixin; | 822 ClassMirror get mixin; |
814 | 823 |
815 // TODO(ahe): What about: | 824 // TODO(ahe): What about: |
816 // /// Finds the instance member named [name] declared or inherited in the | 825 // /// Finds the instance member named [name] declared or inherited in the |
817 // /// reflected class. | 826 // /// reflected class. |
818 // DeclarationMirror instanceLookup(Symbol name); | 827 // DeclarationMirror instanceLookup(Symbol name); |
819 | 828 |
820 /** | 829 /** |
821 * Invokes the named constructor and returns a mirror on the result. | 830 * Invokes the named constructor and returns a mirror on the result. |
822 * | 831 * |
823 * Let *c* be the class reflected by this mirror | 832 * Let *c* be the class reflected by this mirror, |
824 * let *a1, ..., an* be the elements of [positionalArguments] | 833 * let *a1, ..., an* be the elements of [positionalArguments], |
825 * let *k1, ..., km* be the identifiers denoted by the elements of | 834 * let *k1, ..., km* be the identifiers denoted by the elements of |
826 * [namedArguments.keys] | 835 * [namedArguments.keys], |
827 * and let *v1, ..., vm* be the elements of [namedArguments.values]. | 836 * and let *v1, ..., vm* be the elements of [namedArguments.values]. |
828 * If [constructorName] was created from the empty string | 837 * |
829 * Then this method will execute the instance creation expression | 838 * If [constructorName] was created from the empty string, then this method |
830 * *new c(a1, ..., an, k1: v1, ..., km: vm)* | 839 * will execute the instance creation expression |
831 * in a scope that has access to the private members | 840 * *new c(a1, ..., an, k1: v1, ..., km: vm)* in a scope that has access to |
832 * of *c*. Otherwise, let | 841 * the private members of *c*. |
833 * *f* be the simple name of the constructor denoted by [constructorName] | 842 * |
834 * Then this method will execute the instance creation expression | 843 * Otherwise, let *f* be the simple name of the constructor denoted by |
835 * *new c.f(a1, ..., an, k1: v1, ..., km: vm)* | 844 * [constructorName]. Then this method will execute the instance creation |
836 * in a scope that has access to the private members | 845 * expression *new c.f(a1, ..., an, k1: v1, ..., km: vm)* in a scope that has |
837 * of *c*. | 846 * access to the private members of *c*. |
| 847 * |
838 * In either case: | 848 * In either case: |
839 * If the expression evaluates to a result *r*, this method returns | 849 * |
840 * the result of calling [reflect]\(*r*\). | 850 * * If the expression evaluates to a result *r*, this method returns the |
841 * If evaluating the expression causes a compilation error | 851 * result of calling [reflect]\(*r*\). |
842 * the effect is the same as if a non-reflective compilation error | 852 * * If evaluating the expression causes a compilation error, the effect is |
843 * had been encountered. | 853 * the same as if a non-reflective compilation error had been encountered. |
844 * If evaluating the expression throws an exception *e* | 854 * * If evaluating the expression throws an exception *e* (that it does not |
845 * (that it does not catch) | 855 * catch), this method throws *e*. |
846 * this method throws *e*. | |
847 */ | 856 */ |
848 InstanceMirror newInstance(Symbol constructorName, | 857 InstanceMirror newInstance(Symbol constructorName, |
849 List positionalArguments, | 858 List positionalArguments, |
850 [Map<Symbol,dynamic> namedArguments]); | 859 [Map<Symbol,dynamic> namedArguments]); |
851 | 860 |
852 /** | 861 /** |
853 * Returns [:true:] if this mirror is equal to [other]. | 862 * Whether this mirror is equal to [other]. |
854 * Otherwise returns [:false:]. | |
855 * | 863 * |
856 * The equality holds if and only if | 864 * The equality holds if and only if |
857 * (1) [other] is a mirror of the same kind | |
858 * and | |
859 * (2) This mirror and [other] reflect the same class. | |
860 * | 865 * |
861 * Note that if the reflected class is an invocation of | 866 * 1. [other] is a mirror of the same kind, and |
862 * a generic class,(2) implies that the reflected class | 867 * 2. This mirror and [other] reflect the same class. |
863 * and [other] have equal type arguments. | 868 * |
| 869 * Note that if the reflected class is an invocation of a generic class, 2. |
| 870 * implies that the reflected class and [other] have equal type arguments. |
864 */ | 871 */ |
865 bool operator == (other); | 872 bool operator == (other); |
866 | 873 |
867 /** | 874 /** |
868 * Returns whether the class denoted by the receiver is a subclass of the | 875 * Returns whether the class denoted by the receiver is a subclass of the |
869 * class denoted by the argument. | 876 * class denoted by the argument. |
870 * | 877 * |
871 * Note that the subclass relationship is reflexive. | 878 * Note that the subclass relationship is reflexive. |
872 */ | 879 */ |
873 bool isSubclassOf(ClassMirror other); | 880 bool isSubclassOf(ClassMirror other); |
874 } | 881 } |
875 | 882 |
(...skipping 14 matching lines...) Expand all Loading... |
890 | 897 |
891 /** | 898 /** |
892 * A mirror on the [:call:] method for the reflectee. | 899 * A mirror on the [:call:] method for the reflectee. |
893 */ | 900 */ |
894 // This is only here because in the past the VM did not implement a call | 901 // This is only here because in the past the VM did not implement a call |
895 // method on closures. | 902 // method on closures. |
896 MethodMirror get callMethod; | 903 MethodMirror get callMethod; |
897 } | 904 } |
898 | 905 |
899 /** | 906 /** |
900 * A [TypeVariableMirror] represents a type parameter of a generic | 907 * A [TypeVariableMirror] represents a type parameter of a generic type. |
901 * type. | |
902 */ | 908 */ |
903 abstract class TypeVariableMirror extends TypeMirror { | 909 abstract class TypeVariableMirror extends TypeMirror { |
904 /** | 910 /** |
905 * A mirror on the type that is the upper bound of this type variable. | 911 * A mirror on the type that is the upper bound of this type variable. |
906 */ | 912 */ |
907 TypeMirror get upperBound; | 913 TypeMirror get upperBound; |
908 | 914 |
909 /** | 915 /** |
910 * Is the reflectee static? | 916 * Is the reflectee static? |
911 * | 917 * |
912 * For the purposes of the mirrors library, type variables are considered | 918 * For the purposes of the mirrors library, type variables are considered |
913 * non-static. | 919 * non-static. |
914 */ | 920 */ |
915 bool get isStatic; | 921 bool get isStatic; |
916 | 922 |
917 /** | 923 /** |
918 * Returns [:true:] if this mirror is equal to [other]. | 924 * Whether [other] is a [TypeVariableMirror] on the same type variable as this |
919 * Otherwise returns [:false:]. | 925 * mirror. |
920 * | 926 * |
921 * The equality holds if and only if | 927 * The equality holds if and only if |
922 * (1) [other] is a mirror of the same kind | 928 * |
923 * and | 929 * 1. [other] is a mirror of the same kind, and |
924 * (2) [:simpleName == other.simpleName:] and | 930 * 2. [:simpleName == other.simpleName:] and [:owner == other.owner:]. |
925 * [:owner == other.owner:]. | |
926 */ | 931 */ |
927 bool operator == (other); | 932 bool operator == (other); |
928 } | 933 } |
929 | 934 |
930 /** | 935 /** |
931 * A [TypedefMirror] represents a typedef in a Dart language program. | 936 * A [TypedefMirror] represents a typedef in a Dart language program. |
932 */ | 937 */ |
933 abstract class TypedefMirror implements TypeMirror { | 938 abstract class TypedefMirror implements TypeMirror { |
934 /** | 939 /** |
935 * The defining type for this typedef. | 940 * The defining type for this typedef. |
936 * If the the type referred to by the reflectee is a function type | |
937 * *F*, the result will be [:FunctionTypeMirror:] reflecting *F* | |
938 * which is abstract and has an abstract method [:call:] whose | |
939 * signature corresponds to *F*. | |
940 * | 941 * |
| 942 * If the the type referred to by the reflectee is a function type *F*, the |
| 943 * result will be [:FunctionTypeMirror:] reflecting *F* which is abstract |
| 944 * and has an abstract method [:call:] whose signature corresponds to *F*. |
941 * For instance [:void f(int):] is the referent for [:typedef void f(int):]. | 945 * For instance [:void f(int):] is the referent for [:typedef void f(int):]. |
942 */ | 946 */ |
943 FunctionTypeMirror get referent; | 947 FunctionTypeMirror get referent; |
944 } | 948 } |
945 | 949 |
946 /** | 950 /** |
947 * A [MethodMirror] reflects a Dart language function, method, | 951 * A [MethodMirror] reflects a Dart language function, method, |
948 * constructor, getter, or setter. | 952 * constructor, getter, or setter. |
949 */ | 953 */ |
950 abstract class MethodMirror implements DeclarationMirror { | 954 abstract class MethodMirror implements DeclarationMirror { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 * Is the reflectee a redirecting constructor? | 1043 * Is the reflectee a redirecting constructor? |
1040 */ | 1044 */ |
1041 bool get isRedirectingConstructor; | 1045 bool get isRedirectingConstructor; |
1042 | 1046 |
1043 /** | 1047 /** |
1044 * Is the reflectee a factory constructor? | 1048 * Is the reflectee a factory constructor? |
1045 */ | 1049 */ |
1046 bool get isFactoryConstructor; | 1050 bool get isFactoryConstructor; |
1047 | 1051 |
1048 /** | 1052 /** |
1049 * Returns true if this mirror is equal to [other]. | 1053 * Whether this mirror is equal to [other]. |
1050 * | 1054 * |
1051 * The equality holds if and only if | 1055 * The equality holds if and only if |
1052 * (1) [other] is a mirror of the same kind | 1056 * |
1053 * and | 1057 * 1. [other] is a mirror of the same kind, and |
1054 * (2) [:simpleName == other.simpleName:] and | 1058 * 2. [:simpleName == other.simpleName:] and [:owner == other.owner:]. |
1055 * [:owner == other.owner:]. | |
1056 */ | 1059 */ |
1057 bool operator == (other); | 1060 bool operator == (other); |
1058 } | 1061 } |
1059 | 1062 |
1060 /** | 1063 /** |
1061 * A [VariableMirror] reflects a Dart language variable declaration. | 1064 * A [VariableMirror] reflects a Dart language variable declaration. |
1062 */ | 1065 */ |
1063 abstract class VariableMirror implements DeclarationMirror { | 1066 abstract class VariableMirror implements DeclarationMirror { |
1064 /** | 1067 /** |
1065 * Returns a mirror on the type of the reflectee. | 1068 * Returns a mirror on the type of the reflectee. |
1066 */ | 1069 */ |
1067 TypeMirror get type; | 1070 TypeMirror get type; |
(...skipping 13 matching lines...) Expand all Loading... |
1081 */ | 1084 */ |
1082 bool get isFinal; | 1085 bool get isFinal; |
1083 | 1086 |
1084 /** | 1087 /** |
1085 * Returns [:true:] if the reflectee is declared [:const:]. | 1088 * Returns [:true:] if the reflectee is declared [:const:]. |
1086 * Otherwise returns [:false:]. | 1089 * Otherwise returns [:false:]. |
1087 */ | 1090 */ |
1088 bool get isConst; | 1091 bool get isConst; |
1089 | 1092 |
1090 /** | 1093 /** |
1091 * Returns true if this mirror is equal to [other]. | 1094 * Whether this mirror is equal to [other]. |
1092 * | 1095 * |
1093 * The equality holds if and only if | 1096 * The equality holds if and only if |
1094 * (1) [other] is a mirror of the same kind | 1097 * |
1095 * and | 1098 * 1. [other] is a mirror of the same kind, and |
1096 * (2) [:simpleName == other.simpleName:] and | 1099 * 2. [:simpleName == other.simpleName:] and [:owner == other.owner:]. |
1097 * [:owner == other.owner:]. | |
1098 */ | 1100 */ |
1099 bool operator == (other); | 1101 bool operator == (other); |
1100 } | 1102 } |
1101 | 1103 |
1102 /** | 1104 /** |
1103 * A [ParameterMirror] reflects a Dart formal parameter declaration. | 1105 * A [ParameterMirror] reflects a Dart formal parameter declaration. |
1104 */ | 1106 */ |
1105 abstract class ParameterMirror implements VariableMirror { | 1107 abstract class ParameterMirror implements VariableMirror { |
1106 /** | 1108 /** |
1107 * A mirror on the type of this parameter. | 1109 * A mirror on the type of this parameter. |
1108 */ | 1110 */ |
1109 TypeMirror get type; | 1111 TypeMirror get type; |
(...skipping 10 matching lines...) Expand all Loading... |
1120 */ | 1122 */ |
1121 bool get isNamed; | 1123 bool get isNamed; |
1122 | 1124 |
1123 /** | 1125 /** |
1124 * Returns [:true:] if the reflectee has explicitly declared a default value. | 1126 * Returns [:true:] if the reflectee has explicitly declared a default value. |
1125 * Otherwise returns [:false:]. | 1127 * Otherwise returns [:false:]. |
1126 */ | 1128 */ |
1127 bool get hasDefaultValue; | 1129 bool get hasDefaultValue; |
1128 | 1130 |
1129 /** | 1131 /** |
1130 * If this is a required parameter, returns [:null:]. Otherwise returns a | 1132 * Returns the default value of an optional parameter. |
1131 * mirror on the default value for this parameter. If no default is declared | 1133 * |
1132 * for an optional parameter, the default is [:null:] and a mirror on [:null:] | 1134 * Returns an [InstanceMirror] on the (compile-time constant) |
1133 * is returned. | 1135 * default value for an optional parameter. |
| 1136 * If no default value is declared, it defaults to `null` |
| 1137 * and a mirror of `null` is returned. |
| 1138 * |
| 1139 * Returns `null` for a required parameter. |
1134 */ | 1140 */ |
1135 InstanceMirror get defaultValue; | 1141 InstanceMirror get defaultValue; |
1136 } | 1142 } |
1137 | 1143 |
1138 /** | 1144 /** |
1139 * A [SourceLocation] describes the span of an entity in Dart source code. | 1145 * A [SourceLocation] describes the span of an entity in Dart source code. |
1140 */ | 1146 */ |
1141 abstract class SourceLocation { | 1147 abstract class SourceLocation { |
1142 /** | 1148 /** |
1143 * The 1-based line number for this source location. | 1149 * The 1-based line number for this source location. |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 final override; | 1436 final override; |
1431 | 1437 |
1432 /** | 1438 /** |
1433 * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets], | 1439 * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets], |
1434 * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation | 1440 * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation |
1435 * of the parameters. | 1441 * of the parameters. |
1436 */ | 1442 */ |
1437 const MirrorsUsed( | 1443 const MirrorsUsed( |
1438 {this.symbols, this.targets, this.metaTargets, this.override}); | 1444 {this.symbols, this.targets, this.metaTargets, this.override}); |
1439 } | 1445 } |
OLD | NEW |