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

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, 1 month 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
« no previous file with comments | « runtime/lib/mirrors_impl.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 468
469 /** 469 /**
470 * Perform [invocation] on [reflectee]. 470 * Perform [invocation] on [reflectee].
471 * Equivalent to 471 * Equivalent to
472 * 472 *
473 * this.invoke(invocation.memberName, 473 * this.invoke(invocation.memberName,
474 * invocation.positionalArguments, 474 * invocation.positionalArguments,
475 * invocation.namedArguments); 475 * invocation.namedArguments);
476 */ 476 */
477 delegate(Invocation invocation); 477 delegate(Invocation invocation);
478
479 /**
480 * Returns a closure for invoking the regular method named [name].
481 *
482 * If [:type.instanceLookup(name):] returns a regular method m, the result of
483 * this method is a closure equivalent to:
484 *
485 * (r1, ..., rn, {p1: d1, ..., pk: dk}) {
486 * return this.invoke(name, [r1, ..., rn], {#p1: p1, ..., #pk: pk});
487 * }
488 *
489 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
490 * with defaults d1, ..., dk. The result of this method is a
491 * closure equivalent to:
492 *
493 * (r1, ..., rn, [p1 = d1, ..., pk = dk]) {
494 * return this.invoke(name, [r1, ..., rn, p1, ..., pk]);
495 * }
496 *
497 * if m has required parameters r1, ..., rn, and optional positional
498 * parameters p1, ..., pk with defaults d1, ..., dk. Otherwise, an
499 * [ArgumentError] is thrown.
500 */
501 Function operator [](Symbol name);
478 } 502 }
479 503
480 /** 504 /**
481 * A [ClosureMirror] reflects a closure. 505 * A [ClosureMirror] reflects a closure.
482 * 506 *
483 * A [ClosureMirror] provides access to its captured variables and 507 * A [ClosureMirror] provides access to its captured variables and
484 * provides the ability to execute its reflectee. 508 * provides the ability to execute its reflectee.
485 */ 509 */
486 abstract class ClosureMirror implements InstanceMirror { 510 abstract class ClosureMirror implements InstanceMirror {
487 /** 511 /**
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 * 583 *
560 * The equality holds if and only if 584 * The equality holds if and only if
561 * (1) [other] is a mirror of the same kind 585 * (1) [other] is a mirror of the same kind
562 * and 586 * and
563 * (2) The library being reflected by this mirror 587 * (2) The library being reflected by this mirror
564 * and the library being reflected by [other] 588 * and the library being reflected by [other]
565 * are 589 * are
566 * the same library in the same isolate. 590 * the same library in the same isolate.
567 */ 591 */
568 bool operator ==(other); 592 bool operator ==(other);
593
594 /**
595 * If [:declarations[name]:] is a regular method m, the result of this method
596 * is a closure equivalent to:
597 *
598 * (r1, ..., rn, {p1: d1, ..., pk: dk}) {
599 * return this.invoke(name, [r1, ..., rn], {#p1: p1, ..., #pk: pk});
600 * }
601 *
602 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
603 * with defaults d1, ..., dk. The result of this method is a
604 * closure equivalent to:
605 *
606 * (r1, ..., rn, [p1 = d1, ..., pk = dk]) {
607 * return this.invoke(name, [r1, ..., rn, p1, ..., pk]);
608 * }
609 *
610 * if m has required parameters r1, ..., rn, and optional positional
611 * parameters p1, ..., pk with defaults d1, ..., dk. Otherwise, an
612 * [ArgumentError] is thrown.
613 */
614 Function operator [](Symbol name);
569 } 615 }
570 616
571 /** 617 /**
572 * A [TypeMirror] reflects a Dart language class, typedef, 618 * A [TypeMirror] reflects a Dart language class, typedef,
573 * function type or type variable. 619 * function type or type variable.
574 */ 620 */
575 abstract class TypeMirror implements DeclarationMirror { 621 abstract class TypeMirror implements DeclarationMirror {
576 /** 622 /**
577 * An immutable list with mirrors for all type variables for this type. 623 * An immutable list with mirrors for all type variables for this type.
578 * 624 *
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 * The equality holds if and only if 762 * The equality holds if and only if
717 * (1) [other] is a mirror of the same kind 763 * (1) [other] is a mirror of the same kind
718 * and 764 * and
719 * (2) This mirror and [other] reflect the same class. 765 * (2) This mirror and [other] reflect the same class.
720 * 766 *
721 * Note that if the reflected class is an invocation of 767 * Note that if the reflected class is an invocation of
722 * a generic class,(2) implies that the reflected class 768 * a generic class,(2) implies that the reflected class
723 * and [other] have equal type arguments. 769 * and [other] have equal type arguments.
724 */ 770 */
725 bool operator == (other); 771 bool operator == (other);
772
773 /**
774 * If [:declarations[name]:] is a regular method m, the result of this method
775 * is a closure equivalent to:
776 *
777 * (r1, ..., rn, {p1: d1, ..., pk: dk}) {
778 * return this.invoke(name, [r1, ..., rn], {#p1: p1, ..., #pk: pk});
779 * }
780 *
781 * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
782 * with defaults d1, ..., dk. The result of this method is a
783 * closure equivalent to:
784 *
785 * (r1, ..., rn, [p1 = d1, ..., pk = dk]) {
786 * return this.invoke(name, [r1, ..., rn, p1, ..., pk]);
787 * }
788 *
789 * if m has required parameters r1, ..., rn, and optional positional
790 * parameters p1, ..., pk with defaults d1, ..., dk. Otherwise, an
791 * [ArgumentError] is thrown.
792 */
793 Function operator [](Symbol name);
726 } 794 }
727 795
728 /** 796 /**
729 * A [FunctionTypeMirror] represents the type of a function in the 797 * A [FunctionTypeMirror] represents the type of a function in the
730 * Dart language. 798 * Dart language.
731 */ 799 */
732 abstract class FunctionTypeMirror implements ClassMirror { 800 abstract class FunctionTypeMirror implements ClassMirror {
733 /** 801 /**
734 * Returns the return type of the reflectee. 802 * Returns the return type of the reflectee.
735 */ 803 */
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 * 1157 *
1090 * When used as metadata on an import of "dart:mirrors", this metadata does 1158 * When used as metadata on an import of "dart:mirrors", this metadata does
1091 * not apply to the library in which the annotation is used, but instead 1159 * not apply to the library in which the annotation is used, but instead
1092 * applies to the other libraries (all libraries if "*" is used). 1160 * applies to the other libraries (all libraries if "*" is used).
1093 */ 1161 */
1094 final override; 1162 final override;
1095 1163
1096 const MirrorsUsed( 1164 const MirrorsUsed(
1097 {this.symbols, this.targets, this.metaTargets, this.override}); 1165 {this.symbols, this.targets, this.metaTargets, this.override});
1098 } 1166 }
OLDNEW
« no previous file with comments | « runtime/lib/mirrors_impl.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698