| 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 #library('mirrors'); | 5 #library('mirrors'); |
| 6 | 6 |
| 7 #import('dart:io'); | 7 #import('dart:io'); |
| 8 #import('dart:uri'); | 8 #import('dart:uri'); |
| 9 | 9 |
| 10 // TODO(rnystrom): Use "package:" URL (#4968). | 10 // TODO(rnystrom): Use "package:" URL (#4968). |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 */ | 96 */ |
| 97 String get displayName; | 97 String get displayName; |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Returns the name of this entity qualified by is enclosing context. For | 100 * Returns the name of this entity qualified by is enclosing context. For |
| 101 * instance, the qualified name of a method 'method' in class 'Class' in | 101 * instance, the qualified name of a method 'method' in class 'Class' in |
| 102 * library 'library' is 'library.Class.method'. | 102 * library 'library' is 'library.Class.method'. |
| 103 */ | 103 */ |
| 104 String get qualifiedName; | 104 String get qualifiedName; |
| 105 | 105 |
| 106 /** |
| 107 * The source location of this Dart language entity. |
| 108 */ |
| 109 SourceLocation get location; |
| 106 } | 110 } |
| 107 | 111 |
| 108 /** | 112 /** |
| 109 * Common interface for interface types and libraries. | 113 * Common interface for interface types and libraries. |
| 110 */ | 114 */ |
| 111 abstract class ObjectMirror implements Mirror { | 115 abstract class ObjectMirror implements Mirror { |
| 112 | 116 |
| 113 /** | 117 /** |
| 114 * Returns an unmodifiable map of the members of declared in this type or | 118 * Returns an unmodifiable map of the members of declared in this type or |
| 115 * library. | 119 * library. |
| 116 */ | 120 */ |
| 117 Map<String, MemberMirror> get declaredMembers; | 121 Map<String, MemberMirror> get declaredMembers; |
| 118 } | 122 } |
| 119 | 123 |
| 120 /** | 124 /** |
| 121 * A library. | 125 * A library. |
| 122 */ | 126 */ |
| 123 abstract class LibraryMirror implements ObjectMirror, DeclarationMirror { | 127 abstract class LibraryMirror implements ObjectMirror, DeclarationMirror { |
| 124 /** | 128 /** |
| 125 * The name of the library, as given in #library(). | 129 * The name of the library, as given in #library(). |
| 126 */ | 130 */ |
| 127 String get simpleName; | 131 String get simpleName; |
| 128 | 132 |
| 129 /** | 133 /** |
| 130 * Returns an iterable over all types in the library. | 134 * Returns an iterable over all types in the library. |
| 131 */ | 135 */ |
| 132 Map<String, ClassMirror> get types; | 136 Map<String, ClassMirror> get types; |
| 133 | 137 |
| 134 /** | 138 /** |
| 135 * Returns the source location for this library. | |
| 136 */ | |
| 137 Location get location; | |
| 138 | |
| 139 /** | |
| 140 * Returns the canonical URI for this library. | 139 * Returns the canonical URI for this library. |
| 141 */ | 140 */ |
| 142 Uri get uri; | 141 Uri get uri; |
| 143 } | 142 } |
| 144 | 143 |
| 145 /** | 144 /** |
| 146 * Common interface for classes, interfaces, typedefs and type variables. | 145 * Common interface for classes, interfaces, typedefs and type variables. |
| 147 */ | 146 */ |
| 148 abstract class TypeMirror implements DeclarationMirror { | 147 abstract class TypeMirror implements DeclarationMirror { |
| 149 /** | 148 /** |
| 150 * Returns the source location for this type. | |
| 151 */ | |
| 152 Location get location; | |
| 153 | |
| 154 /** | |
| 155 * Returns the library in which this member resides. | 149 * Returns the library in which this member resides. |
| 156 */ | 150 */ |
| 157 LibraryMirror get library; | 151 LibraryMirror get library; |
| 158 | 152 |
| 159 /** | 153 /** |
| 160 * Is [:true:] iff this type is the [:Object:] type. | 154 * Is [:true:] iff this type is the [:Object:] type. |
| 161 */ | 155 */ |
| 162 bool get isObject; | 156 bool get isObject; |
| 163 | 157 |
| 164 /** | 158 /** |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 * for a [:typedef void f(int):]. | 295 * for a [:typedef void f(int):]. |
| 302 */ | 296 */ |
| 303 TypeMirror get definition; | 297 TypeMirror get definition; |
| 304 } | 298 } |
| 305 | 299 |
| 306 /** | 300 /** |
| 307 * A member of a type, i.e. a field, method or constructor. | 301 * A member of a type, i.e. a field, method or constructor. |
| 308 */ | 302 */ |
| 309 abstract class MemberMirror implements DeclarationMirror { | 303 abstract class MemberMirror implements DeclarationMirror { |
| 310 /** | 304 /** |
| 311 * Returns the source location for this member. | |
| 312 */ | |
| 313 Location get location; | |
| 314 | |
| 315 /** | |
| 316 * Returns a mirror on the declaration immediately surrounding the reflectee. | 305 * Returns a mirror on the declaration immediately surrounding the reflectee. |
| 317 * This could be a class, interface, library or another method or function. | 306 * This could be a class, interface, library or another method or function. |
| 318 */ | 307 */ |
| 319 ObjectMirror get surroundingDeclaration; | 308 ObjectMirror get surroundingDeclaration; |
| 320 | 309 |
| 321 /** | 310 /** |
| 322 * Returns true if this is a top level member, i.e. a member not within a | 311 * Returns true if this is a top level member, i.e. a member not within a |
| 323 * type. | 312 * type. |
| 324 */ | 313 */ |
| 325 bool get isTopLevel; | 314 bool get isTopLevel; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 */ | 449 */ |
| 461 bool get isInitializingFormal; | 450 bool get isInitializingFormal; |
| 462 | 451 |
| 463 /** | 452 /** |
| 464 * Returns the initialized field, if this parameter is an initializing formal. | 453 * Returns the initialized field, if this parameter is an initializing formal. |
| 465 */ | 454 */ |
| 466 FieldMirror get initializedField; | 455 FieldMirror get initializedField; |
| 467 } | 456 } |
| 468 | 457 |
| 469 /** | 458 /** |
| 470 * A [Location] describes the span of an entity in Dart source code. | 459 * A [SourceLocation] describes the span of an entity in Dart source code. |
| 471 * A [Location] should be the minimum span that encloses the declaration of the | 460 * A [SourceLocation] should be the minimum span that encloses the declaration |
| 472 * mirrored entity. | 461 * of the mirrored entity. |
| 473 */ | 462 */ |
| 474 abstract class Location { | 463 abstract class SourceLocation { |
| 475 /** | 464 /** |
| 476 * The character position where the location begins. | 465 * The character position where the location begins. |
| 477 */ | 466 */ |
| 478 int get start; | 467 int get start; |
| 479 | 468 |
| 480 /** | 469 /** |
| 481 * The character position where the location ends. | 470 * The character position where the location ends. |
| 482 */ | 471 */ |
| 483 int get end; | 472 int get end; |
| 484 | 473 |
| 485 /** | 474 /** |
| 486 * Returns the [Source] in which this [Location] indexes. | 475 * Returns the [Source] in which this [SourceLocation] indexes. |
| 487 * If [:loc:] is a location, [:loc.source().text()[loc.start]:] is where it | 476 * If [:loc:] is a location, [:loc.source().text()[loc.start]:] is where it |
| 488 * starts, and [:loc.source().text()[loc.end]:] is where it ends. | 477 * starts, and [:loc.source().text()[loc.end]:] is where it ends. |
| 489 */ | 478 */ |
| 490 Source get source; | 479 Source get source; |
| 491 | 480 |
| 492 /** | 481 /** |
| 493 * The text of the location span. | 482 * The text of the location span. |
| 494 */ | 483 */ |
| 495 String get text; | 484 String get text; |
| 496 } | 485 } |
| 497 | 486 |
| 498 /** | 487 /** |
| 499 * A [Source] describes the source code of a compilation unit in Dart source | 488 * A [Source] describes the source code of a compilation unit in Dart source |
| 500 * code. | 489 * code. |
| 501 */ | 490 */ |
| 502 abstract class Source { | 491 abstract class Source { |
| 503 /** | 492 /** |
| 504 * Returns the URI where the source originated. | 493 * Returns the URI where the source originated. |
| 505 */ | 494 */ |
| 506 Uri get uri; | 495 Uri get uri; |
| 507 | 496 |
| 508 /** | 497 /** |
| 509 * Returns the text of this source. | 498 * Returns the text of this source. |
| 510 */ | 499 */ |
| 511 String get text; | 500 String get text; |
| 512 } | 501 } |
| OLD | NEW |