| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 /** | 356 /** |
| 357 * A list of mirrors on the superinterfaces of the reflectee. | 357 * A list of mirrors on the superinterfaces of the reflectee. |
| 358 */ | 358 */ |
| 359 final List<ClassMirror> superinterfaces; | 359 final List<ClassMirror> superinterfaces; |
| 360 | 360 |
| 361 /** | 361 /** |
| 362 * An immutable map from from names to mirrors for all members of | 362 * An immutable map from from names to mirrors for all members of |
| 363 * this type. | 363 * this type. |
| 364 * | 364 * |
| 365 * The members of an interface are its constructors, methods, | 365 * The members of a type are its methods, fields, getters, and |
| 366 * fields, getters, and setters. | 366 * setters. Note that constructors and type variables are not |
| 367 * considered to be members of a type. |
| 367 * | 368 * |
| 368 * This does not include inherited members. | 369 * This does not include inherited members. |
| 369 */ | 370 */ |
| 370 final Map<String, Mirror> members; | 371 final Map<String, Mirror> members; |
| 371 | 372 |
| 372 /** | 373 /** |
| 373 * An immutable map from names to mirrors for all method, | 374 * An immutable map from names to mirrors for all method, |
| 374 * constructor, getter, and setter declarations for this type. | 375 * declarations for this type. This does not include getters and |
| 376 * setters. |
| 375 */ | 377 */ |
| 376 final Map<String, MethodMirror> methods; | 378 final Map<String, MethodMirror> methods; |
| 377 | 379 |
| 378 /** | 380 /** |
| 379 * An immutable map from names to mirrors for all constructor | |
| 380 * declarations for this type. | |
| 381 */ | |
| 382 final Map<String, MethodMirror> constructors; | |
| 383 | |
| 384 /** | |
| 385 * An immutable map from names to mirrors for all getter | 381 * An immutable map from names to mirrors for all getter |
| 386 * declarations for this type. | 382 * declarations for this type. |
| 387 */ | 383 */ |
| 388 final Map<String, MethodMirror> getters; | 384 final Map<String, MethodMirror> getters; |
| 389 | 385 |
| 390 /** | 386 /** |
| 391 * An immutable map from names to mirrors for all setter | 387 * An immutable map from names to mirrors for all setter |
| 392 * declarations for this type. | 388 * declarations for this type. |
| 393 */ | 389 */ |
| 394 final Map<String, MethodMirror> setters; | 390 final Map<String, MethodMirror> setters; |
| 395 | 391 |
| 396 /** | 392 /** |
| 397 * An immutable map from names to mirrors for all variable | 393 * An immutable map from names to mirrors for all variable |
| 398 * declarations for this type. | 394 * declarations for this type. |
| 399 */ | 395 */ |
| 400 final Map<String, VariableMirror> variables; | 396 final Map<String, VariableMirror> variables; |
| 401 | 397 |
| 402 /** | 398 /** |
| 403 * A list of type variables for this type. | 399 * An immutable map from names to mirrors for all constructor |
| 400 * declarations for this type. |
| 404 */ | 401 */ |
| 405 final List<TypeVariableMirror> typeVariables; | 402 final Map<String, MethodMirror> constructors; |
| 406 | 403 |
| 407 /** | 404 /** |
| 408 * A list of the type arguments for this type. | 405 * An immutable map from names to mirrors for all type variables for |
| 406 * this type. |
| 407 * |
| 408 * This map preserves the order of declaration of the type variables. |
| 409 */ | 409 */ |
| 410 final List<TypeMirror> typeArguments; | 410 final Map<String, TypeVariableMirror> typeVariables; |
| 411 |
| 412 /** |
| 413 * An immutable map from names to mirrors for all type arguments for |
| 414 * this type. |
| 415 * |
| 416 * This map preserves the order of declaration of the type variables. |
| 417 */ |
| 418 final Map<String, TypeMirror> typeArguments; |
| 411 | 419 |
| 412 /** | 420 /** |
| 413 * Is this the original declaration of this type? | 421 * Is this the original declaration of this type? |
| 414 * | 422 * |
| 415 * For most classes, they are their own original declaration. For | 423 * For most classes, they are their own original declaration. For |
| 416 * generic classes, however, there is a distinction between the | 424 * generic classes, however, there is a distinction between the |
| 417 * original class declaration, which has unbound type variables, and | 425 * original class declaration, which has unbound type variables, and |
| 418 * the instantiations of generic classes, which have bound type | 426 * the instantiations of generic classes, which have bound type |
| 419 * variables. | 427 * variables. |
| 420 */ | 428 */ |
| (...skipping 30 matching lines...) Expand all Loading... |
| 451 /** | 459 /** |
| 452 * A mirror on the default factory class or null if there is none. | 460 * A mirror on the default factory class or null if there is none. |
| 453 * | 461 * |
| 454 * TODO(turnidge): This functions goes away after the | 462 * TODO(turnidge): This functions goes away after the |
| 455 * class/interface changes. | 463 * class/interface changes. |
| 456 */ | 464 */ |
| 457 final ClassMirror defaultFactory; | 465 final ClassMirror defaultFactory; |
| 458 } | 466 } |
| 459 | 467 |
| 460 /** | 468 /** |
| 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 | 469 * A [FunctionTypeMirror] represents the type of a function in the |
| 473 * Dart language. | 470 * Dart language. |
| 474 */ | 471 */ |
| 475 interface FunctionTypeMirror extends TypeMirror { | 472 interface FunctionTypeMirror extends ClassMirror { |
| 476 /** | 473 /** |
| 477 * The return type of the reflectee. | 474 * The return type of the reflectee. |
| 478 */ | 475 */ |
| 479 final TypeMirror returnType; | 476 final TypeMirror returnType; |
| 480 | 477 |
| 481 /** | 478 /** |
| 482 * A list of the parameter types of the reflectee. | 479 * A list of the parameter types of the reflectee. |
| 483 */ | 480 */ |
| 484 final List<ParameterMirror> parameters; | 481 final List<ParameterMirror> parameters; |
| 485 | 482 |
| 486 /** | 483 /** |
| 487 * A mirror on the [:call:] method for the reflectee. | 484 * A mirror on the [:call:] method for the reflectee. |
| 488 * | 485 * |
| 489 * TODO(turnidge): What is this and what is it for? | 486 * TODO(turnidge): What is this and what is it for? |
| 490 */ | 487 */ |
| 491 final MethodMirror callMethod; | 488 final MethodMirror callMethod; |
| 492 } | 489 } |
| 493 | 490 |
| 494 /** | 491 /** |
| 492 * A [TypeVariableMirror] represents a type parameter of a generic |
| 493 * type. |
| 494 */ |
| 495 interface TypeVariableMirror extends TypeMirror { |
| 496 /** |
| 497 * A mirror on the type that is the upper bound of this type variable. |
| 498 */ |
| 499 final TypeMirror upperBound; |
| 500 } |
| 501 |
| 502 /** |
| 495 * A [TypedefMirror] represents a typedef in a Dart language program. | 503 * A [TypedefMirror] represents a typedef in a Dart language program. |
| 496 */ | 504 */ |
| 497 interface TypedefMirror extends ClassMirror { | 505 interface TypedefMirror extends TypeMirror { |
| 498 /** | 506 /** |
| 499 * The defining type for this typedef. | 507 * The defining type for this typedef. |
| 500 * | 508 * |
| 501 * For instance [:void f(int):] is the value for [:typedef void f(int):]. | 509 * For instance [:void f(int):] is the value for [:typedef void f(int):]. |
| 502 */ | 510 */ |
| 503 final TypeMirror value; | 511 final TypeMirror referent; |
| 504 } | 512 } |
| 505 | 513 |
| 506 /** | 514 /** |
| 507 * A [MethodMirror] reflects a Dart language function, method, | 515 * A [MethodMirror] reflects a Dart language function, method, |
| 508 * constructor, getter, or setter. | 516 * constructor, getter, or setter. |
| 509 */ | 517 */ |
| 510 interface MethodMirror extends DeclarationMirror { | 518 interface MethodMirror extends DeclarationMirror { |
| 511 /** | 519 /** |
| 512 * A mirror on the return type for the reflectee. | 520 * A mirror on the return type for the reflectee. |
| 513 */ | 521 */ |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 736 |
| 729 /** | 737 /** |
| 730 * A [MirrorException] is used to indicate errors within the mirrors | 738 * A [MirrorException] is used to indicate errors within the mirrors |
| 731 * framework. | 739 * framework. |
| 732 */ | 740 */ |
| 733 class MirrorException implements Exception { | 741 class MirrorException implements Exception { |
| 734 const MirrorException(String this._message); | 742 const MirrorException(String this._message); |
| 735 String toString() => "MirrorException: '$_message'"; | 743 String toString() => "MirrorException: '$_message'"; |
| 736 final String _message; | 744 final String _message; |
| 737 } | 745 } |
| OLD | NEW |