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

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: fix mistake in merge conflict 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}) {
ahe 2013/10/29 10:25:24 Change ".." (two periods) to "..." (three periods)
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. Otherwise, the result of this method is a
563 * closure equivalent to:
564 *
565 * (r1, .., rn, [p1 = d1, …, pk = dk]) {
ahe 2013/10/29 10:25:24 Change "…" (a single unicode character) to "..." (
566 * return this.invoke(name, [r1, .., rn, p1, .., pk]);
567 * }
568 *
569 * if m has required parameters r1, ..., rn, and optional positional
570 * parameters p1, ..., pk with defaults d1, ..., dk.
ahe 2013/10/29 10:25:24 What happens if [name] isn't a regular method?
571 */
572 Function operator [](Symbol name);
573
ahe 2013/10/29 10:25:24 Extra line.
550 } 574 }
551 575
552 /** 576 /**
553 * A [ClosureMirror] reflects a closure. 577 * A [ClosureMirror] reflects a closure.
554 * 578 *
555 * A [ClosureMirror] provides access to its captured variables and 579 * A [ClosureMirror] provides access to its captured variables and
556 * provides the ability to execute its reflectee. 580 * provides the ability to execute its reflectee.
557 */ 581 */
558 abstract class ClosureMirror implements InstanceMirror { 582 abstract class ClosureMirror implements InstanceMirror {
559 /** 583 /**
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 * 709 *
686 * The equality holds if and only if 710 * The equality holds if and only if
687 * (1) [other] is a mirror of the same kind 711 * (1) [other] is a mirror of the same kind
688 * and 712 * and
689 * (2) The library being reflected by this mirror 713 * (2) The library being reflected by this mirror
690 * and the library being reflected by [other] 714 * and the library being reflected by [other]
691 * are 715 * are
692 * the same library in the same isolate. 716 * the same library in the same isolate.
693 */ 717 */
694 bool operator == (other); 718 bool operator == (other);
719
720 /**
721 * If [:declarations[name]:] is a regular method, the result of this method
722 * is a closure equivalent to:
723 *
724 * (r1, .., rn, {p1: d1, ..., pk: dk}) {
ahe 2013/10/29 10:25:24 Change ".." (two periods) to "..." (three periods)
725 * return this.invoke(name, [r1, .., rn], {#p1: p1, .., #pk: pk});
726 * }
727 *
728 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
729 * with defaults d1, ..., dk. Otherwise, the result of this method is a
730 * closure equivalent to:
731 *
732 * (r1, .., rn, [p1 = d1, …, pk = dk]) {
ahe 2013/10/29 10:25:24 Change to three periods.
733 * return this.invoke(name, [r1, .., rn, p1, .., pk]);
734 * }
735 *
736 * if m has required parameters r1, ..., rn, and optional positional
737 * parameters p1, ..., pk with defaults d1, ..., dk.
ahe 2013/10/29 10:25:24 What happens if [name] isn't a regular method.
738 */
739 Function operator [](Symbol name);
695 } 740 }
696 741
697 /** 742 /**
698 * A [TypeMirror] reflects a Dart language class, typedef, 743 * A [TypeMirror] reflects a Dart language class, typedef,
699 * or type variable. 744 * or type variable.
700 */ 745 */
701 abstract class TypeMirror implements DeclarationMirror { 746 abstract class TypeMirror implements DeclarationMirror {
702 } 747 }
703 748
704 /** 749 /**
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 * The equality holds if and only if 943 * The equality holds if and only if
899 * (1) [other] is a mirror of the same kind 944 * (1) [other] is a mirror of the same kind
900 * and 945 * and
901 * (2) This mirror and [other] reflect the same class. 946 * (2) This mirror and [other] reflect the same class.
902 * 947 *
903 * Note that if the reflected class is an invocation of 948 * Note that if the reflected class is an invocation of
904 * a generic class,(2) implies that the reflected class 949 * a generic class,(2) implies that the reflected class
905 * and [other] have equal type arguments. 950 * and [other] have equal type arguments.
906 */ 951 */
907 bool operator == (other); 952 bool operator == (other);
953
954 /**
955 * If [:declarations[name]:] is a regular method, the result of this method
956 * is a closure equivalent to:
957 *
958 * (r1, .., rn, {p1: d1, ..., pk: dk}) {
ahe 2013/10/29 10:25:24 Same period issues as above: Change ".." to "...",
959 * return this.invoke(name, [r1, .., rn], {#p1: p1, .., #pk: pk});
960 * }
961 *
962 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
963 * with defaults d1, ..., dk. Otherwise, the result of this method is a
964 * closure equivalent to:
965 *
966 * (r1, .., rn, [p1 = d1, …, pk = dk]) {
967 * return this.invoke(name, [r1, .., rn, p1, .., pk]);
968 * }
969 *
970 * if m has required parameters r1, ..., rn, and optional positional
971 * parameters p1, ..., pk with defaults d1, ..., dk.
ahe 2013/10/29 10:25:24 What happens if [name] is not a regular method.
972 */
973 Function operator [](Symbol name);
908 } 974 }
909 975
910 /** 976 /**
911 * A [FunctionTypeMirror] represents the type of a function in the 977 * A [FunctionTypeMirror] represents the type of a function in the
912 * Dart language. 978 * Dart language.
913 */ 979 */
914 abstract class FunctionTypeMirror implements ClassMirror { 980 abstract class FunctionTypeMirror implements ClassMirror {
915 /** 981 /**
916 * Returns the return type of the reflectee. 982 * Returns the return type of the reflectee.
917 */ 983 */
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 * 1413 *
1348 * When used as metadata on an import of "dart:mirrors", this metadata does 1414 * 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 1415 * not apply to the library in which the annotation is used, but instead
1350 * applies to the other libraries (all libraries if "*" is used). 1416 * applies to the other libraries (all libraries if "*" is used).
1351 */ 1417 */
1352 final override; 1418 final override;
1353 1419
1354 const MirrorsUsed( 1420 const MirrorsUsed(
1355 {this.symbols, this.targets, this.metaTargets, this.override}); 1421 {this.symbols, this.targets, this.metaTargets, this.override});
1356 } 1422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698