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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 */ | 489 */ |
490 abstract class ClosureMirror implements InstanceMirror { | 490 abstract class ClosureMirror implements InstanceMirror { |
491 /** | 491 /** |
492 * A mirror on the function associated with this closure. | 492 * A mirror on the function associated with this closure. |
493 * | 493 * |
494 * The function associated with an implicit closure of a function is that | 494 * The function associated with an implicit closure of a function is that |
495 * function. | 495 * function. |
496 * | 496 * |
497 * The function associated with an instance of a class that has a [:call:] | 497 * The function associated with an instance of a class that has a [:call:] |
498 * method is that [:call:] method. | 498 * method is that [:call:] method. |
| 499 * |
| 500 * A Dart implementation might choose to create a class for each closure |
| 501 * expression, in which case [:function:] would be the same as |
| 502 * [:type.declarations[#call]:]. But the Dart language model does not require |
| 503 * this. A more typical implementation involves a single closure class for |
| 504 * each type signature, where the call method dispatches to a function held |
| 505 * in the closure rather the call method |
| 506 * directly implementing the closure body. So one cannot rely on closures from |
| 507 * distinct closure expressions having distinct classes ([:type:]), but one |
| 508 * can rely on them having distinct functions ([:function:]). |
499 */ | 509 */ |
500 MethodMirror get function; | 510 MethodMirror get function; |
501 | 511 |
502 /** | 512 /** |
503 * Executes the closure and returns a mirror on the result. | 513 * Executes the closure and returns a mirror on the result. |
504 * Let *f* be the closure reflected by this mirror, | 514 * Let *f* be the closure reflected by this mirror, |
505 * let *a1, ..., an* be the elements of [positionalArguments] | 515 * let *a1, ..., an* be the elements of [positionalArguments] |
506 * let *k1, ..., km* be the identifiers denoted by the elements of | 516 * let *k1, ..., km* be the identifiers denoted by the elements of |
507 * [namedArguments.keys] | 517 * [namedArguments.keys] |
508 * and let *v1, ..., vm* be the elements of [namedArguments.values]. | 518 * and let *v1, ..., vm* be the elements of [namedArguments.values]. |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 TypeMirror get returnType; | 832 TypeMirror get returnType; |
823 | 833 |
824 /** | 834 /** |
825 * Returns a list of the parameter types of the reflectee. | 835 * Returns a list of the parameter types of the reflectee. |
826 */ | 836 */ |
827 List<ParameterMirror> get parameters; | 837 List<ParameterMirror> get parameters; |
828 | 838 |
829 /** | 839 /** |
830 * A mirror on the [:call:] method for the reflectee. | 840 * A mirror on the [:call:] method for the reflectee. |
831 */ | 841 */ |
| 842 // This is only here because in the past the VM did not implement a call |
| 843 // method on closures. |
832 MethodMirror get callMethod; | 844 MethodMirror get callMethod; |
833 } | 845 } |
834 | 846 |
835 /** | 847 /** |
836 * A [TypeVariableMirror] represents a type parameter of a generic | 848 * A [TypeVariableMirror] represents a type parameter of a generic |
837 * type. | 849 * type. |
838 */ | 850 */ |
839 abstract class TypeVariableMirror extends TypeMirror { | 851 abstract class TypeVariableMirror extends TypeMirror { |
840 /** | 852 /** |
841 * A mirror on the type that is the upper bound of this type variable. | 853 * A mirror on the type that is the upper bound of this type variable. |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 * | 1226 * |
1215 * When used as metadata on an import of "dart:mirrors", this metadata does | 1227 * When used as metadata on an import of "dart:mirrors", this metadata does |
1216 * not apply to the library in which the annotation is used, but instead | 1228 * not apply to the library in which the annotation is used, but instead |
1217 * applies to the other libraries (all libraries if "*" is used). | 1229 * applies to the other libraries (all libraries if "*" is used). |
1218 */ | 1230 */ |
1219 final override; | 1231 final override; |
1220 | 1232 |
1221 const MirrorsUsed( | 1233 const MirrorsUsed( |
1222 {this.symbols, this.targets, this.metaTargets, this.override}); | 1234 {this.symbols, this.targets, this.metaTargets, this.override}); |
1223 } | 1235 } |
OLD | NEW |