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

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

Issue 25741005: Implement ObjectMirror.[] (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 540
541 /** 541 /**
542 * Perform [invocation] on [reflectee]. 542 * Perform [invocation] on [reflectee].
543 * Equivalent to 543 * Equivalent to
544 * 544 *
545 * this.invoke(invocation.memberName, 545 * this.invoke(invocation.memberName,
546 * invocation.positionalArguments, 546 * invocation.positionalArguments,
547 * invocation.namedArguments); 547 * invocation.namedArguments);
548 */ 548 */
549 delegate(Invocation invocation); 549 delegate(Invocation invocation);
550
551 /**
552 * Returns a closure for invoking the regular method named [name].
553 *
554 * If [:type.instanceLookup(name):] returns a regular method, the result of
555 * this method is a closure equivalent to:
556 *
557 * (r1, .., rn, {p1: d1, ..., pk: dk}) {
558 * return this.invoke(name, [r1, .., rn], {#p1: p1, .., #pk: pk});
559 * }
560 *
561 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
562 * with defaults d1, ..., dk.
563 *
564 * (r1, .., rn, [p1 = d1, …, pk = dk]) {
565 * return this.invoke(name, [r1, .., rn, p1, .., pk]);
566 * }
567 *
568 * if m has required parameters r1, ..., rn, and optional positional
569 * parameters p1, ..., pk with defaults d1, ..., dk.
570 */
gbracha 2013/10/03 00:58:54 See proposed modification to wording below. Appli
rmacnak 2013/10/03 16:58:07 Done.
571 Function operator [](Symbol name);
572
550 } 573 }
551 574
552 /** 575 /**
553 * A [ClosureMirror] reflects a closure. 576 * A [ClosureMirror] reflects a closure.
554 * 577 *
555 * A [ClosureMirror] provides access to its captured variables and 578 * A [ClosureMirror] provides access to its captured variables and
556 * provides the ability to execute its reflectee. 579 * provides the ability to execute its reflectee.
557 */ 580 */
558 abstract class ClosureMirror implements InstanceMirror { 581 abstract class ClosureMirror implements InstanceMirror {
559 /** 582 /**
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 * 708 *
686 * The equality holds if and only if 709 * The equality holds if and only if
687 * (1) [other] is a mirror of the same kind 710 * (1) [other] is a mirror of the same kind
688 * and 711 * and
689 * (2) The library being reflected by this mirror 712 * (2) The library being reflected by this mirror
690 * and the library being reflected by [other] 713 * and the library being reflected by [other]
691 * are 714 * are
692 * the same library in the same isolate. 715 * the same library in the same isolate.
693 */ 716 */
694 bool operator == (other); 717 bool operator == (other);
718
719 /**
720 * If [:declarations[name]:] is a regular method, the result of this method
721 * is a closure equivalent to:
722 *
723 * (r1, .., rn, {p1: d1, ..., pk: dk}) {
724 * return this.invoke(name, [r1, .., rn], {#p1: p1, .., #pk: pk});
725 * }
726 *
727 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
728 * with defaults d1, ..., dk.
729 *
730 * (r1, .., rn, [p1 = d1, …, pk = dk]) {
731 * return this.invoke(name, [r1, .., rn, p1, .., pk]);
732 * }
733 *
734 * if m has required parameters r1, ..., rn, and optional positional
735 * parameters p1, ..., pk with defaults d1, ..., dk.
736 */
737 Function operator [](Symbol name);
695 } 738 }
696 739
697 /** 740 /**
698 * A [TypeMirror] reflects a Dart language class, typedef, 741 * A [TypeMirror] reflects a Dart language class, typedef,
699 * or type variable. 742 * or type variable.
700 */ 743 */
701 abstract class TypeMirror implements DeclarationMirror { 744 abstract class TypeMirror implements DeclarationMirror {
702 } 745 }
703 746
704 /** 747 /**
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 * The equality holds if and only if 941 * The equality holds if and only if
899 * (1) [other] is a mirror of the same kind 942 * (1) [other] is a mirror of the same kind
900 * and 943 * and
901 * (2) This mirror and [other] reflect the same class. 944 * (2) This mirror and [other] reflect the same class.
902 * 945 *
903 * Note that if the reflected class is an invocation of 946 * Note that if the reflected class is an invocation of
904 * a generic class,(2) implies that the reflected class 947 * a generic class,(2) implies that the reflected class
905 * and [other] have equal type arguments. 948 * and [other] have equal type arguments.
906 */ 949 */
907 bool operator == (other); 950 bool operator == (other);
951
952 /**
953 * If [:declarations[name]:] is a regular method, the result of this method
954 * is a closure equivalent to:
955 *
956 * (r1, .., rn, {p1: d1, ..., pk: dk}) {
957 * return this.invoke(name, [r1, .., rn], {#p1: p1, .., #pk: pk});
958 * }
959 *
960 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
961 * with defaults d1, ..., dk.
gbracha 2013/10/03 00:58:54 Otherwise, the result of this method is a closure
962 *
963 * (r1, .., rn, [p1 = d1, …, pk = dk]) {
964 * return this.invoke(name, [r1, .., rn, p1, .., pk]);
965 * }
966 *
967 * if m has required parameters r1, ..., rn, and optional positional
968 * parameters p1, ..., pk with defaults d1, ..., dk.
969 */
970 Function operator [](Symbol name);
908 } 971 }
909 972
910 /** 973 /**
911 * A [FunctionTypeMirror] represents the type of a function in the 974 * A [FunctionTypeMirror] represents the type of a function in the
912 * Dart language. 975 * Dart language.
913 */ 976 */
914 abstract class FunctionTypeMirror implements ClassMirror { 977 abstract class FunctionTypeMirror implements ClassMirror {
915 /** 978 /**
916 * Returns the return type of the reflectee. 979 * Returns the return type of the reflectee.
917 */ 980 */
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 * 1410 *
1348 * When used as metadata on an import of "dart:mirrors", this metadata does 1411 * When used as metadata on an import of "dart:mirrors", this metadata does
1349 * not apply to the library in which the annotation is used, but instead 1412 * not apply to the library in which the annotation is used, but instead
1350 * applies to the other libraries (all libraries if "*" is used). 1413 * applies to the other libraries (all libraries if "*" is used).
1351 */ 1414 */
1352 final override; 1415 final override;
1353 1416
1354 const MirrorsUsed( 1417 const MirrorsUsed(
1355 {this.symbols, this.targets, this.metaTargets, this.override}); 1418 {this.symbols, this.targets, this.metaTargets, this.override});
1356 } 1419 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698