Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // The dart:mirrors library provides reflective access for Dart program. | 5 // The dart:mirrors library provides reflective access for Dart program. |
| 6 // | 6 // |
| 7 // For the purposes of the mirrors library, we adopt a naming | 7 // For the purposes of the mirrors library, we adopt a naming |
| 8 // convention with respect to getters and setters. Specifically, for | 8 // convention with respect to getters and setters. Specifically, for |
| 9 // some variable or field... | 9 // some variable or field... |
| 10 // | 10 // |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 final Map<String, MethodMirror> setters; | 394 final Map<String, MethodMirror> setters; |
| 395 | 395 |
| 396 /** | 396 /** |
| 397 * An immutable map from names to mirrors for all variable | 397 * An immutable map from names to mirrors for all variable |
| 398 * declarations for this type. | 398 * declarations for this type. |
| 399 */ | 399 */ |
| 400 final Map<String, VariableMirror> variables; | 400 final Map<String, VariableMirror> variables; |
| 401 | 401 |
| 402 /** | 402 /** |
| 403 * A list of type variables for this type. | 403 * A list of type variables for this type. |
| 404 * | |
| 405 * This map preserves the order of declaration of the type variables. | |
|
cshapiro
2012/09/12 18:52:07
I am not sure I understand the value of this comme
turnidge
2012/09/12 21:39:30
Since maps are not by default ordered, this commen
| |
| 404 */ | 406 */ |
| 405 final List<TypeVariableMirror> typeVariables; | 407 final Map<String, TypeVariableMirror> typeVariables; |
| 406 | 408 |
| 407 /** | 409 /** |
| 408 * A list of the type arguments for this type. | 410 * A list of the type arguments for this type. |
| 411 * | |
| 412 * This map preserves the order of declaration of the type variables. | |
|
cshapiro
2012/09/12 18:52:07
Same here as above.
| |
| 409 */ | 413 */ |
| 410 final List<TypeMirror> typeArguments; | 414 final Map<String, TypeMirror> typeArguments; |
| 411 | 415 |
| 412 /** | 416 /** |
| 413 * Is this the original declaration of this type? | 417 * Is this the original declaration of this type? |
| 414 * | 418 * |
| 415 * For most classes, they are their own original declaration. For | 419 * For most classes, they are their own original declaration. For |
| 416 * generic classes, however, there is a distinction between the | 420 * generic classes, however, there is a distinction between the |
| 417 * original class declaration, which has unbound type variables, and | 421 * original class declaration, which has unbound type variables, and |
| 418 * the instantiations of generic classes, which have bound type | 422 * the instantiations of generic classes, which have bound type |
| 419 * variables. | 423 * variables. |
| 420 */ | 424 */ |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 451 /** | 455 /** |
| 452 * A mirror on the default factory class or null if there is none. | 456 * A mirror on the default factory class or null if there is none. |
| 453 * | 457 * |
| 454 * TODO(turnidge): This functions goes away after the | 458 * TODO(turnidge): This functions goes away after the |
| 455 * class/interface changes. | 459 * class/interface changes. |
| 456 */ | 460 */ |
| 457 final ClassMirror defaultFactory; | 461 final ClassMirror defaultFactory; |
| 458 } | 462 } |
| 459 | 463 |
| 460 /** | 464 /** |
| 461 * A [TypeVariableMirror] represents a type parameter of a generic | |
| 462 * type. | |
| 463 */ | |
| 464 interface TypeVariableMirror extends TypeMirror { | |
| 465 /** | |
| 466 * A mirror on the type that is the upper bound for this type variable. | |
| 467 */ | |
| 468 final TypeMirror upperBound; | |
| 469 } | |
| 470 | |
| 471 /** | |
| 472 * A [FunctionTypeMirror] represents the type of a function in the | 465 * A [FunctionTypeMirror] represents the type of a function in the |
| 473 * Dart language. | 466 * Dart language. |
| 474 */ | 467 */ |
| 475 interface FunctionTypeMirror extends TypeMirror { | 468 interface FunctionTypeMirror extends ClassMirror { |
| 476 /** | 469 /** |
| 477 * The return type of the reflectee. | 470 * The return type of the reflectee. |
| 478 */ | 471 */ |
| 479 final TypeMirror returnType; | 472 final TypeMirror returnType; |
| 480 | 473 |
| 481 /** | 474 /** |
| 482 * A list of the parameter types of the reflectee. | 475 * A list of the parameter types of the reflectee. |
| 483 */ | 476 */ |
| 484 final List<ParameterMirror> parameters; | 477 final List<ParameterMirror> parameters; |
| 485 | 478 |
| 486 /** | 479 /** |
| 487 * A mirror on the [:call:] method for the reflectee. | 480 * A mirror on the [:call:] method for the reflectee. |
| 488 * | 481 * |
| 489 * TODO(turnidge): What is this and what is it for? | 482 * TODO(turnidge): What is this and what is it for? |
| 490 */ | 483 */ |
| 491 final MethodMirror callMethod; | 484 final MethodMirror callMethod; |
| 492 } | 485 } |
| 493 | 486 |
| 494 /** | 487 /** |
| 488 * A [TypeVariableMirror] represents a type parameter of a generic | |
| 489 * type. | |
| 490 */ | |
| 491 interface TypeVariableMirror extends TypeMirror { | |
| 492 /** | |
| 493 * A mirror on the type that is the upper bound for this type variable. | |
|
cshapiro
2012/09/12 18:52:07
Maybe "of this type variable" instead of "for this
turnidge
2012/09/12 21:39:30
Done.
| |
| 494 */ | |
| 495 final TypeMirror upperBound; | |
| 496 } | |
| 497 | |
| 498 /** | |
| 495 * A [TypedefMirror] represents a typedef in a Dart language program. | 499 * A [TypedefMirror] represents a typedef in a Dart language program. |
| 496 */ | 500 */ |
| 497 interface TypedefMirror extends ClassMirror { | 501 interface TypedefMirror extends TypeMirror { |
| 498 /** | 502 /** |
| 499 * The defining type for this typedef. | 503 * The defining type for this typedef. |
| 500 * | 504 * |
| 501 * For instance [:void f(int):] is the value for [:typedef void f(int):]. | 505 * For instance [:void f(int):] is the value for [:typedef void f(int):]. |
| 502 */ | 506 */ |
| 503 final TypeMirror value; | 507 final TypeMirror referent; |
| 504 } | 508 } |
| 505 | 509 |
| 506 /** | 510 /** |
| 507 * A [MethodMirror] reflects a Dart language function, method, | 511 * A [MethodMirror] reflects a Dart language function, method, |
| 508 * constructor, getter, or setter. | 512 * constructor, getter, or setter. |
| 509 */ | 513 */ |
| 510 interface MethodMirror extends DeclarationMirror { | 514 interface MethodMirror extends DeclarationMirror { |
| 511 /** | 515 /** |
| 512 * A mirror on the return type for the reflectee. | 516 * A mirror on the return type for the reflectee. |
| 513 */ | 517 */ |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 728 | 732 |
| 729 /** | 733 /** |
| 730 * A [MirrorException] is used to indicate errors within the mirrors | 734 * A [MirrorException] is used to indicate errors within the mirrors |
| 731 * framework. | 735 * framework. |
| 732 */ | 736 */ |
| 733 class MirrorException implements Exception { | 737 class MirrorException implements Exception { |
| 734 const MirrorException(String this._message); | 738 const MirrorException(String this._message); |
| 735 String toString() => "MirrorException: '$_message'"; | 739 String toString() => "MirrorException: '$_message'"; |
| 736 final String _message; | 740 final String _message; |
| 737 } | 741 } |
| OLD | NEW |