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 #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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 abstract Future<String> compileToJavaScript(); | 48 abstract Future<String> compileToJavaScript(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * The main interface for the whole mirror system. | 52 * The main interface for the whole mirror system. |
| 53 */ | 53 */ |
| 54 abstract class MirrorSystem { | 54 abstract class MirrorSystem { |
| 55 /** | 55 /** |
| 56 * Returns an unmodifiable map of all libraries in this mirror system. | 56 * Returns an unmodifiable map of all libraries in this mirror system. |
| 57 */ | 57 */ |
| 58 Map<Object, LibraryMirror> get libraries; | 58 Map<String, LibraryMirror> get libraries; |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * An entity in the mirror system. | 63 * An entity in the mirror system. |
| 64 */ | 64 */ |
| 65 abstract class Mirror { | 65 abstract class Mirror { |
| 66 static const String UNARY_MINUS = 'unary-'; | |
| 67 | |
| 66 /** | 68 /** |
| 67 * The simple name of the entity. The simple name is in most cases the | 69 * The simple name of the entity. The simple name is unique within the |
| 68 * the declared single identifier name of the entity, such as 'method' for | 70 * scope of the entity declaration. |
| 69 * a method [:void method() {...}:]. | 71 * |
| 72 * The simple name is in most cases the the declared single identifier name of | |
|
ngeoffray
2012/10/02 20:19:43
the the -> the
Johnni Winther
2012/10/03 09:36:24
Done.
| |
| 73 * the entity, such as 'method' for a method [:void method() {...}:]. For an | |
| 74 * unnamed constructor for [:class Foo:] the simple name is 'Foo'. For a | |
| 75 * constructor for [:class Foo:] named 'named' the simple name is 'Foo.named'. | |
| 76 * For a property [:foo:] the simple name of the getter method is 'foo' and | |
| 77 * the simple name of the setter is 'foo='. For operators the simple name is | |
| 78 * the operator itself, for example '+' for [:operator +:]. | |
| 79 * | |
| 80 * The simple name for the unary minus operator is [UNARY_MINUS]. | |
| 70 */ | 81 */ |
| 71 String get simpleName; | 82 String get simpleName; |
| 72 | 83 |
| 73 /** | 84 /** |
| 85 * The display name is normal representation of the entity name. In most cases | |
|
ngeoffray
2012/10/02 20:19:43
is normal -> is the normal
Johnni Winther
2012/10/03 09:36:24
Done.
| |
| 86 * the display name is the simple name, but for a setter 'foo=' the display | |
| 87 * name is simply 'foo' and for the unary minus operator the display name is | |
| 88 * 'operator -'. The display name is not unique. | |
| 89 */ | |
| 90 String get displayName; | |
| 91 | |
| 92 /** | |
| 74 * Returns the name of this entity qualified by is enclosing context. For | 93 * Returns the name of this entity qualified by is enclosing context. For |
| 75 * instance, the qualified name of a method 'method' in class 'Class' in | 94 * instance, the qualified name of a method 'method' in class 'Class' in |
| 76 * library 'library' is 'library.Class.method'. | 95 * library 'library' is 'library.Class.method'. |
| 77 */ | 96 */ |
| 78 String get qualifiedName; | 97 String get qualifiedName; |
| 79 | 98 |
| 80 /** | 99 /** |
| 81 * Returns the mirror system which contains this mirror. | 100 * Returns the mirror system which contains this mirror. |
| 82 */ | 101 */ |
| 83 MirrorSystem get system; | 102 MirrorSystem get system; |
| 84 } | 103 } |
| 85 | 104 |
| 86 /** | 105 /** |
| 87 * Common interface for interface types and libraries. | 106 * Common interface for interface types and libraries. |
| 88 */ | 107 */ |
| 89 abstract class ObjectMirror implements Mirror { | 108 abstract class ObjectMirror implements Mirror { |
| 90 | 109 |
| 91 /** | 110 /** |
| 92 * Returns an unmodifiable map of the members of declared in this type or | 111 * Returns an unmodifiable map of the members of declared in this type or |
| 93 * library. | 112 * library. |
| 94 */ | 113 */ |
| 95 Map<Object, MemberMirror> get declaredMembers; | 114 Map<String, MemberMirror> get declaredMembers; |
| 96 } | 115 } |
| 97 | 116 |
| 98 /** | 117 /** |
| 99 * A library. | 118 * A library. |
| 100 */ | 119 */ |
| 101 abstract class LibraryMirror extends ObjectMirror { | 120 abstract class LibraryMirror extends ObjectMirror { |
| 102 /** | 121 /** |
| 103 * The name of the library, as given in #library(). | 122 * The name of the library, as given in #library(). |
| 104 */ | 123 */ |
| 105 String get simpleName; | 124 String get simpleName; |
| 106 | 125 |
| 107 /** | 126 /** |
| 108 * Returns an iterable over all types in the library. | 127 * Returns an iterable over all types in the library. |
| 109 */ | 128 */ |
| 110 Map<Object, InterfaceMirror> get types; | 129 Map<String, InterfaceMirror> get types; |
| 111 | 130 |
| 112 /** | 131 /** |
| 113 * Returns the source location for this library. | 132 * Returns the source location for this library. |
| 114 */ | 133 */ |
| 115 Location get location; | 134 Location get location; |
| 116 } | 135 } |
| 117 | 136 |
| 118 /** | 137 /** |
| 119 * Common interface for classes, interfaces, typedefs and type variables. | 138 * Common interface for classes, interfaces, typedefs and type variables. |
| 120 */ | 139 */ |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 */ | 188 */ |
| 170 InterfaceMirror get declaration; | 189 InterfaceMirror get declaration; |
| 171 | 190 |
| 172 /** | 191 /** |
| 173 * Returns the super class of this type, or null if this type is [Object] or a | 192 * Returns the super class of this type, or null if this type is [Object] or a |
| 174 * typedef. | 193 * typedef. |
| 175 */ | 194 */ |
| 176 InterfaceMirror get superclass; | 195 InterfaceMirror get superclass; |
| 177 | 196 |
| 178 /** | 197 /** |
| 179 * Returns an iterable over the interfaces directly implemented by this type. | 198 * Returns a list of the interfaces directly implemented by this type. |
| 180 */ | 199 */ |
| 181 Map<Object, InterfaceMirror> get interfaces; | 200 List<InterfaceMirror> get interfaces; |
| 182 | 201 |
| 183 /** | 202 /** |
| 184 * Is [:true:] iff this type is a class. | 203 * Is [:true:] iff this type is a class. |
| 185 */ | 204 */ |
| 186 bool get isClass; | 205 bool get isClass; |
| 187 | 206 |
| 188 /** | 207 /** |
| 189 * Is [:true:] iff this type is an interface. | 208 * Is [:true:] iff this type is an interface. |
| 190 */ | 209 */ |
| 191 bool get isInterface; | 210 bool get isInterface; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 211 List<TypeMirror> get typeArguments; | 230 List<TypeMirror> get typeArguments; |
| 212 | 231 |
| 213 /** | 232 /** |
| 214 * Returns the list of type variables for this type. | 233 * Returns the list of type variables for this type. |
| 215 */ | 234 */ |
| 216 List<TypeVariableMirror> get typeVariables; | 235 List<TypeVariableMirror> get typeVariables; |
| 217 | 236 |
| 218 /** | 237 /** |
| 219 * Returns an immutable map of the constructors in this interface. | 238 * Returns an immutable map of the constructors in this interface. |
| 220 */ | 239 */ |
| 221 Map<Object, MethodMirror> get constructors; | 240 Map<String, MethodMirror> get constructors; |
| 222 | 241 |
| 223 /** | 242 /** |
| 224 * Returns the default type for this interface. | 243 * Returns the default type for this interface. |
| 225 */ | 244 */ |
| 226 InterfaceMirror get defaultType; | 245 InterfaceMirror get defaultType; |
| 227 } | 246 } |
| 228 | 247 |
| 229 /** | 248 /** |
| 230 * A type parameter as declared on a generic type. | 249 * A type parameter as declared on a generic type. |
| 231 */ | 250 */ |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 /** | 490 /** |
| 472 * Returns the URI where the source originated. | 491 * Returns the URI where the source originated. |
| 473 */ | 492 */ |
| 474 Uri get uri; | 493 Uri get uri; |
| 475 | 494 |
| 476 /** | 495 /** |
| 477 * Returns the text of this source. | 496 * Returns the text of this source. |
| 478 */ | 497 */ |
| 479 String get text; | 498 String get text; |
| 480 } | 499 } |
| OLD | NEW |