Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: lib/mirrors/mirrors.dart

Issue 10854197: A round of edits to make mirrors.dart more like our current working (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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");
6
7 // The dart:mirrors library provides reflective access for Dart program. 5 // The dart:mirrors library provides reflective access for Dart program.
8 // 6 //
9 // For the purposes of the mirrors library, we adopt a naming 7 // For the purposes of the mirrors library, we adopt a naming
10 // convention with respect to getters and setters. Specifically, for 8 // convention with respect to getters and setters. Specifically, for
11 // some variable or field... 9 // some variable or field...
12 // 10 //
13 // var myField; 11 // var myField;
14 // 12 //
15 // ...the getter is named 'myField' and the setter is named 13 // ...the getter is named 'myField' and the setter is named
16 // 'myField='. This allows us to assign unique names to getters and 14 // 'myField='. This allows us to assign unique names to getters and
17 // setters for the purposes of member lookup. 15 // setters for the purposes of member lookup.
18 // 16
19 // TODO(turnidge): Finish implementing this api. 17 // #library("mirrors");
cshapiro 2012/08/17 19:06:09 Any reason this is still commented out?
turnidge 2012/08/17 19:44:10 For now we can't have these #directives in code bu
20 18
21 /** 19 /**
22 * A [MirrorSystem] is the main interface used to reflect on a set of 20 * A [MirrorSystem] is the main interface used to reflect on a set of
23 * associated libraries. 21 * associated libraries.
24 * 22 *
25 * At runtime each running isolate has a distinct [MirrorSystem]. 23 * At runtime each running isolate has a distinct [MirrorSystem].
26 * 24 *
27 * It is also possible to have a [MirrorSystem] which represents a set 25 * It is also possible to have a [MirrorSystem] which represents a set
28 * of libraries which are not running -- perhaps at compile-time. In 26 * of libraries which are not running -- perhaps at compile-time. In
29 * this case, all available reflective functionality would be 27 * this case, all available reflective functionality would be
30 * supported, but runtime functionality (such as invoking a function 28 * supported, but runtime functionality (such as invoking a function
31 * or inspecting the contents of a variable) would fail dynamically. 29 * or inspecting the contents of a variable) would fail dynamically.
32 */ 30 */
33 interface MirrorSystem { 31 interface MirrorSystem {
34 /** 32 /**
35 * A mirror on the root library of the mirror system.
36 */
37 final LibraryMirror rootLibrary;
38
39 /**
40 * An immutable map from from library names to mirrors for all 33 * An immutable map from from library names to mirrors for all
41 * libraries known to this mirror system. 34 * libraries known to this mirror system.
42 */ 35 */
43 Map<String, LibraryMirror> libraries(); 36 final Map<String, LibraryMirror> libraries;
44 37
45 /** 38 /**
46 * A mirror on the isolate associated with this [MirrorSystem]. 39 * A mirror on the isolate associated with this [MirrorSystem].
47 * This may be null if this mirror system is not running. 40 * This may be null if this mirror system is not running.
48 */ 41 */
49 IsolateMirror isolate; 42 final IsolateMirror isolate;
50 43
51 /** 44 /**
52 * Returns an [InstanceMirror] for some Dart language object. 45 * A mirror on the [:Dynamic:] type.
53 *
54 * This only works if this mirror system is associated with the
55 * current running isolate.
56 */ 46 */
57 InstanceMirror mirrorOf(Object reflectee); 47 final TypeMirror dynamicType;
48
49 /**
50 * A mirror on the [:void:] type.
51 */
52 final TypeMirror voidType;
58 } 53 }
59 54
60 /** 55 /**
61 * Returns a [MirrorSystem] for the current isolate. 56 * Returns a [MirrorSystem] for the current isolate.
62 */ 57 */
63 MirrorSystem currentMirrorSystem() { 58 MirrorSystem currentMirrorSystem() {
64 return _Mirrors.currentMirrorSystem(); 59 return _Mirrors.currentMirrorSystem();
65 } 60 }
66 61
67 /** 62 /**
68 * Creates a [MirrorSystem] for the isolate which is listening on 63 * Creates a [MirrorSystem] for the isolate which is listening on
69 * the [SendPort]. 64 * the [SendPort].
70 */ 65 */
71 Future<MirrorSystem> mirrorSystemOf(SendPort port) { 66 Future<MirrorSystem> mirrorSystemOf(SendPort port) {
72 return _Mirrors.mirrorSystemOf(port); 67 return _Mirrors.mirrorSystemOf(port);
73 } 68 }
74 69
75 /** 70 /**
71 * Returns an [InstanceMirror] for some Dart language object.
72 *
73 * This only works if this mirror system is associated with the
74 * current running isolate.
75 */
76 InstanceMirror reflect(Object reflectee) {
77 return _Mirrors.reflect(reflectee);
78 }
79
80 /**
76 * A [Mirror] reflects some Dart language entity. 81 * A [Mirror] reflects some Dart language entity.
77 * 82 *
78 * Every [Mirror] originates from some [MirrorSystem]. 83 * Every [Mirror] originates from some [MirrorSystem].
79 */ 84 */
80 interface Mirror { 85 interface Mirror extends Hashable {
81 /** 86 /**
82 * The originating [MirrorSystem] for this mirror. 87 * The [MirrorSystem] which contains this mirror.
cshapiro 2012/08/17 19:06:09 that contains?
turnidge 2012/08/17 19:44:10 Done.
83 */ 88 */
84 final MirrorSystem mirrors; 89 final MirrorSystem mirrors;
85 } 90 }
86 91
87 /** 92 /**
88 * An [IsolateMirror] reflects an isolate. 93 * An [IsolateMirror] reflects an isolate.
89 */ 94 */
90 interface IsolateMirror extends Mirror { 95 interface IsolateMirror extends Mirror {
91 /** 96 /**
92 * A unique name used to refer to an isolate in debugging messages. 97 * A unique name used to refer to an isolate in debugging messages.
93 */ 98 */
94 final String debugName; 99 final String debugName;
95 100
96 /** 101 /**
97 * Does this mirror reflect the currently running isolate? 102 * Does this mirror reflect the currently running isolate?
98 */ 103 */
99 final bool isCurrent; 104 final bool isCurrent;
105
106 /**
107 * A mirror on the root library for this isolate.
108 */
109 final LibraryMirror rootLibrary;
100 } 110 }
101 111
102
103 /** 112 /**
104 * An [ObjectMirror] is a common superinterface of [InstanceMirror], 113 * An [ObjectMirror] is a common superinterface of [InstanceMirror],
105 * [InterfaceMirror], and [LibraryMirror] that represents their shared 114 * [ClassMirror], and [LibraryMirror] that represents their shared
106 * functionality. 115 * functionality.
107 * 116 *
108 * For the purposes of the mirrors library, these types are all 117 * For the purposes of the mirrors library, these types are all
109 * object-like, in that they support method invocation and field 118 * object-like, in that they support method invocation and field
110 * access. Real Dart objects are represented by the [InstanceMirror] 119 * access. Real Dart objects are represented by the [InstanceMirror]
111 * type. 120 * type.
112 * 121 *
113 * See [InstanceMirror], [InterfaceMirror], and [LibraryMirror]. 122 * See [InstanceMirror], [ClassMirror], and [LibraryMirror].
114 */ 123 */
115 interface ObjectMirror extends Mirror { 124 interface ObjectMirror extends Mirror {
116 /** 125 /**
117 * Invokes the named function and returns a mirror on the result. 126 * Invokes the named function and returns a mirror on the result.
118 * 127 *
119 * TODO(turnidge): Properly document. 128 * TODO(turnidge): Properly document.
129 * TODO(turnidge): Handle ambiguous names.
130 * TODO(turnidge): Handle optional & named arguments.
120 */ 131 */
121 Future<InstanceMirror> invoke(String memberName, 132 Future<InstanceMirror> invoke(String memberName,
122 List<Object> positionalArguments, 133 List<Object> positionalArguments,
123 [Map<String,Object> namedArguments]); 134 [Map<String,Object> namedArguments]);
124 135
125 /** 136 /**
126 * Invokes a getter and returns a mirror on the result. The getter may be 137 * Invokes a getter and returns a mirror on the result. The getter
127 * either the implicit getter for a field or a user-defined getter method. 138 * may be either the implicit getter for a field or a user-defined
cshapiro 2012/08/17 19:06:09 can be the implicit...
turnidge 2012/08/17 19:44:10 Done.
139 * getter method.
140 *
141 * TODO(turnidge): Handle ambiguous names.
128 */ 142 */
129 Future<InstanceMirror> getField(String fieldName); 143 Future<InstanceMirror> getField(String fieldName);
130 144
131 /** 145 /**
132 * Invokes a setter and returns a mirror on the result. The setter may be 146 * Invokes a setter and returns a mirror on the result. The setter
133 * either the implicit setter for a non-final field or a user-defined setter 147 * may be either the implicit setter for a non-final field or a
134 * method. 148 * user-defined setter method.
149 *
150 * TODO(turnidge): Handle ambiguous names.
135 */ 151 */
136 Future<InstanceMirror> setField(String fieldName, Object value); 152 Future<InstanceMirror> setField(String fieldName, Object value);
137 } 153 }
138 154
139 /** 155 /**
140 * An [InstanceMirror] reflects an instance of a Dart language object. 156 * An [InstanceMirror] reflects an instance of a Dart language object.
141 */ 157 */
142 interface InstanceMirror extends ObjectMirror { 158 interface InstanceMirror extends ObjectMirror {
143 /** 159 /**
144 * Returns a mirror on the class of the reflectee. 160 * A mirror on the type of the reflectee.
145 */ 161 */
146 InterfaceMirror getClass(); 162 final ClassMirror type;
147 163
148 /** 164 /**
149 * Does [reflectee] contain the instance reflected by this mirror? This will 165 * Does [reflectee] contain the instance reflected by this mirror?
150 * always be true in the local case (reflecting instances in the same 166 * This will always be true in the local case (reflecting instances
151 * isolate), but only true in the remote case if this mirror reflects a 167 * in the same isolate), but only true in the remote case if this
152 * simple value. 168 * mirror reflects a simple value.
cshapiro 2012/08/17 19:06:09 How about adding a top-level function called IsSim
turnidge 2012/08/17 19:44:10 Will do in a follow-up CL.
153 * 169 *
154 * A value is simple if one of the following holds: 170 * A value is simple if one of the following holds:
155 * - the value is null 171 * - the value is null
156 * - the value is of type [num] 172 * - the value is of type [num]
157 * - the value is of type [bool] 173 * - the value is of type [bool]
158 * - the value is of type [String] 174 * - the value is of type [String]
159 */ 175 */
160 final bool hasReflectee; 176 final bool hasReflectee;
161 177
162 /** 178 /**
163 * If the [InstanceMirror] reflects an instance it is meaningful to have a 179 * If the [InstanceMirror] reflects an instance it is meaningful to
164 * local reference to, we provide access to the actual instance here. 180 * have a local reference to, we provide access to the actual
181 * instance here.
165 * 182 *
166 * If you access [reflectee] when [hasReflectee] is false, an 183 * If you access [reflectee] when [hasReflectee] is false, an
167 * exception is thrown. 184 * exception is thrown.
168 */ 185 */
169 final reflectee; 186 final reflectee;
170 } 187 }
171 188
172 /** 189 /**
173 * A [ClosureMirror] reflects a closure. Closures are special, because we do not 190 * A [ClosureMirror] reflects a closure.
174 * wish to reflect the internals of a particular closure implementation. And 191 *
175 * yet, we need access to details of the closure internals - for example, its 192 * A [ClosureMirror] provides access to it's captured variables and
cshapiro 2012/08/17 19:06:09 its not it's.
turnidge 2012/08/17 19:44:10 Done.
176 * enclosing context and its source code. 193 * provides the ability to execute it's reflectee.
cshapiro 2012/08/17 19:06:09 its not it's.
turnidge 2012/08/17 19:44:10 Done. How embarrassing.
177 */ 194 */
178 interface ClosureMirror extends InstanceMirror { 195 interface ClosureMirror extends InstanceMirror {
196 /**
197 * A mirror on the function for this closure.
cshapiro 2012/08/17 19:06:09 of this closure
turnidge 2012/08/17 19:44:10 Changed to "function associated with this closure"
198 */
199 final MethodMirror function;
179 200
180 /** 201 /**
181 * Return the source code for the closure, if available. 202 * The source code for this closure, if available.
cshapiro 2012/08/17 19:06:09 And what if it's not available? Null?
turnidge 2012/08/17 19:44:10 Done. This field will probably go away anyways, I
182 */ 203 *
183 String source(); 204 * TODO(turnidge): Would this just be available in function?
184 205 */
185 /** 206 final String source;
186 * Call the closure. The arguments given in the descriptor need to be
187 * ObjectMirrors or values. Asynchronous.
188 */
189 Future<ObjectMirror> apply(List<Object> positionalArguments,
190 [Map<String,Object> namedArguments]);
191 207
192 /** 208 /**
193 * Look up the value of name in the scope of the closure. The result is a 209 * Executes the closure. The arguments given in the descriptor need to
194 * mirror on that value. Asynchronous. 210 * be InstanceMirrors or simple values.
211 *
212 * A value is simple if one of the following holds:
213 * - the value is null
214 * - the value is of type [num]
215 * - the value is of type [bool]
216 * - the value is of type [String]
195 */ 217 */
196 Future<ObjectMirror> findInContext(String name); 218 Future<InstanceMirror> apply(List<Object> positionalArguments,
219 [Map<String,Object> namedArguments]);
197 220
198 /** 221 /**
199 * Return a mirror on the function of this closure. 222 * Looks up the value of a name in the scope of the closure. The
223 * result is a mirror on that value.
200 */ 224 */
201 MethodMirror function(); 225 Future<InstanceMirror> findInContext(String name);
202 } 226 }
203 227
204 /** 228 /**
205 * A [TypeMirror] reflects a Dart language class, interface, typedef 229 * A [TypeMirror] reflects a Dart language class, interface, typedef
206 * or type variable. 230 * or type variable.
207 */ 231 */
208 interface TypeMirror extends Mirror { 232 interface TypeMirror extends Mirror {
209 /** 233 /**
210 * The library in which this interface is declared. 234 * The library in which this interface is declared.
211 */ 235 */
212 final LibraryMirror library; 236 final LibraryMirror library;
213 } 237 }
214 238
215 /** 239 /**
216 * An [InterfaceMirror] reflects a Dart language class or interface. 240 * A [ClassMirror] reflects a Dart language class or interface.
217 */ 241 */
218 interface InterfaceMirror extends TypeMirror, ObjectMirror { 242 interface ClassMirror extends TypeMirror, ObjectMirror {
219 /** 243 /**
220 * The name of this interface. 244 * The name of this interface.
221 */ 245 */
222 final String simpleName; 246 final String simpleName;
223 247
224 /** 248 /**
225 * Does this mirror represent a class? 249 * Does this mirror represent a class?
226 */ 250 */
227 final bool isClass; 251 final bool isClass;
228 252
229 /** 253 /**
230 * Returns a mirror on the superclass on the reflectee. 254 * Returns a mirror on the superclass on the reflectee.
231 * 255 *
232 * For interfaces, the superclass is Object. 256 * For interfaces, the superclass is Object.
233 */ 257 */
234 InterfaceMirror superclass(); 258 final ClassMirror superclass;
235 259
236 /** 260 /**
237 * Returns a list of mirrors on the superinterfaces for the reflectee. 261 * Returns a list of mirrors on the superinterfaces for the reflectee.
238 */ 262 */
239 List<InterfaceMirror> superinterfaces(); 263 final List<ClassMirror> superinterfaces;
240 264
241 /** 265 /**
242 * Returns a mirror on the default factory class or null if there is 266 * Returns a mirror on the default factory class or null if there is
243 * none. 267 * none.
244 */ 268 */
245 InterfaceMirror defaultFactory(); 269 final ClassMirror defaultFactory;
246 270
247 /** 271 /**
248 * An immutable map from from names to mirrors for all members of 272 * An immutable map from from names to mirrors for all members of
249 * this type. 273 * this type.
250 * 274 *
251 * The members of an interface are its constructors, methods, 275 * The members of an interface are its constructors, methods,
252 * fields, getters, and setters. 276 * fields, getters, and setters.
253 * 277 *
254 * This does not include inherited members. 278 * This does not include inherited members.
255 */ 279 */
256 Map<String, Mirror> members(); 280 final Map<String, Mirror> members;
257 281
258 /** 282 /**
259 * An immutable map from names to mirrors for all method, 283 * An immutable map from names to mirrors for all method,
260 * constructor, getter, and setter declarations in this library. 284 * constructor, getter, and setter declarations in this library.
261 */ 285 */
262 Map<String, MethodMirror> methods(); 286 final Map<String, MethodMirror> methods;
263 287
264 /** 288 /**
265 * An immutable map from names to mirrors for all variable 289 * An immutable map from names to mirrors for all variable
266 * declarations in this library. 290 * declarations in this library.
267 */ 291 */
268 Map<String, VariableMirror> variables(); 292 final Map<String, VariableMirror> variables;
269 293
270 /** 294 /**
271 * Invokes the named constructor and returns a mirror on the result. 295 * Invokes the named constructor and returns a mirror on the result.
272 * 296 *
273 * TODO(turnidge): Properly document. 297 * TODO(turnidge): Properly document.
274 */ 298 */
275 Future<InstanceMirror> newInstance(String constructorName, 299 Future<InstanceMirror> newInstance(String constructorName,
276 List<Object> positionalArguments, 300 List<Object> positionalArguments,
277 [Map<String,Object> namedArguments]); 301 [Map<String,Object> namedArguments]);
278 } 302 }
(...skipping 17 matching lines...) Expand all
296 */ 320 */
297 final String url; 321 final String url;
298 322
299 /** 323 /**
300 * An immutable map from from names to mirrors for all members in 324 * An immutable map from from names to mirrors for all members in
301 * this library. 325 * this library.
302 * 326 *
303 * The members of a library are its top-level classes, interfaces, 327 * The members of a library are its top-level classes, interfaces,
304 * functions, variables, getters, and setters. 328 * functions, variables, getters, and setters.
305 */ 329 */
306 Map<String, Mirror> members(); 330 final Map<String, Mirror> members;
307 331
308 /** 332 /**
309 * An immutable map from names to mirrors for all class and 333 * An immutable map from names to mirrors for all class and
310 * interface declarations in this library. 334 * interface declarations in this library.
311 */ 335 */
312 Map<String, InterfaceMirror> classes(); 336 final Map<String, ClassMirror> classes;
313 337
314 /** 338 /**
315 * An immutable map from names to mirrors for all function 339 * An immutable map from names to mirrors for all function
316 * declarations in this library. 340 * declarations in this library.
317 */ 341 */
318 Map<String, MethodMirror> functions(); 342 final Map<String, MethodMirror> functions;
319 343
320 /** 344 /**
321 * An immutable map from names to mirrors for all variable 345 * An immutable map from names to mirrors for all variable
322 * declarations in this library. 346 * declarations in this library.
323 */ 347 */
324 Map<String, VariableMirror> variables(); 348 final Map<String, VariableMirror> variables;
325 } 349 }
326 350
327 /** 351 /**
328 * A [MethodMirror] reflects a Dart language function, method, 352 * A [MethodMirror] reflects a Dart language function, method,
329 * constructor, getter, or setter. 353 * constructor, getter, or setter.
330 */ 354 */
331 interface MethodMirror { 355 interface MethodMirror {
332 /** 356 /**
333 * The name of this function. 357 * The name of this function.
334 */ 358 */
335 final String simpleName; 359 final String simpleName;
336 360
337 /** 361 /**
338 * A mirror on the owner of this function. This is the declaration 362 * A mirror on the owner of this function. This is the declaration
339 * immediately surrounding the reflectee. 363 * immediately surrounding the reflectee.
340 * 364 *
341 * For top-level functions, this will be a [LibraryMirror] and for 365 * For top-level functions, this will be a [LibraryMirror] and for
342 * methods, constructors, getters, and setters, this will be an 366 * methods, constructors, getters, and setters, this will be an
343 * [InterfaceMirror]. 367 * [ClassMirror].
344 */ 368 */
345 Mirror owner; 369 final Mirror owner;
346 370
347 // Ownership 371 // Ownership
348 372
349 /** 373 /**
350 * Does this mirror reflect a top-level function? 374 * Does this mirror reflect a top-level function?
351 */ 375 */
352 bool isTopLevel; 376 final bool isTopLevel;
353 377
354 /** 378 /**
355 * Does this mirror reflect a static method? 379 * Does this mirror reflect a static method?
356 * 380 *
357 * For the purposes of the mirrors library, a top-level function is 381 * For the purposes of the mirrors library, a top-level function is
358 * considered static. 382 * considered static.
359 */ 383 */
360 bool isStatic; 384 final bool isStatic;
361 385
362 // Method kind 386 // Method kind
363 387
364 /** 388 /**
365 * Does this mirror reflect a regular function or method? 389 * Does this mirror reflect a regular function or method?
366 * 390 *
367 * A method is regular if it is not a getter, setter, or constructor. 391 * A method is regular if it is not a getter, setter, or constructor.
368 */ 392 */
369 bool isMethod; 393 final bool isMethod;
370 394
371 /** 395 /**
372 * Does this mirror reflect an abstract method? 396 * Does this mirror reflect an abstract method?
373 */ 397 */
374 bool isAbstract; 398 final bool isAbstract;
375 399
376 /** 400 /**
377 * Does this mirror reflect a getter? 401 * Does this mirror reflect a getter?
378 */ 402 */
379 bool isGetter; 403 final bool isGetter;
380 404
381 /** 405 /**
382 * Does this mirror reflect a setter? 406 * Does this mirror reflect a setter?
383 */ 407 */
384 bool isSetter; 408 final bool isSetter;
385 409
386 /** 410 /**
387 * Does this mirror reflect a constructor? 411 * Does this mirror reflect a constructor?
388 */ 412 */
389 bool isConstructor; 413 final bool isConstructor;
390 414
391 // Constructor kind 415 // Constructor kind
392 416
393 /** 417 /**
394 * Does this mirror reflect a const constructor? 418 * Does this mirror reflect a const constructor?
395 */ 419 */
396 bool isConstConstructor; 420 final bool isConstConstructor;
397 421
398 /** 422 /**
399 * Does this mirror reflect a generative constructor? 423 * Does this mirror reflect a generative constructor?
400 */ 424 */
401 bool isGenerativeConstructor; 425 final bool isGenerativeConstructor;
402 426
403 /** 427 /**
404 * Does this mirror reflect a redirecting constructor? 428 * Does this mirror reflect a redirecting constructor?
405 */ 429 */
406 bool isRedirectingConstructor; 430 final bool isRedirectingConstructor;
407 431
408 /** 432 /**
409 * Does this mirror reflect a factory constructor? 433 * Does this mirror reflect a factory constructor?
410 */ 434 */
411 bool isFactoryConstructor; 435 final bool isFactoryConstructor;
412 436
413 /** 437 /**
414 * Returns the list of parameters for this method. 438 * Returns the list of parameters for this method.
415 */ 439 */
416 List<ParameterMirror> parameters(); 440 List<ParameterMirror> parameters();
cshapiro 2012/08/17 19:06:09 This should be a final field (a getter).
turnidge 2012/08/17 19:44:10 Done.
417 } 441 }
418 442
419 /** 443 /**
420 * A [ParameterMirror] reflects a Dart formal parameter declaration. 444 * A [ParameterMirror] reflects a Dart formal parameter declaration.
421 */ 445 */
422 interface ParameterMirror extends VariableMirror { 446 interface ParameterMirror extends VariableMirror {
423 /** 447 /**
424 * Returns the type of this parameter. 448 * Returns the type of this parameter.
425 */ 449 */
426 TypeMirror type; 450 TypeMirror type;
cshapiro 2012/08/17 19:06:09 This should be final.
turnidge 2012/08/17 19:44:10 Done.
427 451
428 /** 452 /**
429 * Returns the default value for this parameter. 453 * Returns the default value for this parameter.
430 */ 454 */
431 String defaultValue; 455 String defaultValue;
cshapiro 2012/08/17 19:06:09 And this should be final too.
turnidge 2012/08/17 19:44:10 Done.
432 456
433 /** 457 /**
434 * Returns true if this parameter has a default value. 458 * Returns true if this parameter has a default value.
435 */ 459 */
436 bool hasDefaultValue; 460 final bool hasDefaultValue;
437 461
438 /** 462 /**
439 * Returns true if this parameter is optional. 463 * Returns true if this parameter is optional.
440 */ 464 */
441 bool isOptional; 465 final bool isOptional;
442 } 466 }
443 467
444 /** 468 /**
445 * A [VariableMirror] reflects a Dart language variable declaration. 469 * A [VariableMirror] reflects a Dart language variable declaration.
446 */ 470 */
447 interface VariableMirror { 471 interface VariableMirror {
448 /** 472 /**
449 * The name of this variable 473 * The name of this variable
450 */ 474 */
451 final String simpleName; 475 final String simpleName;
452 476
453 /** 477 /**
454 * A mirror on the owner of this method. The owner is the 478 * A mirror on the owner of this method. The owner is the
455 * declaration immediately surrounding the reflectee. 479 * declaration immediately surrounding the reflectee.
456 * 480 *
457 * For top-level variables, this will be a [LibraryMirror] and for 481 * For top-level variables, this will be a [LibraryMirror] and for
458 * class and interface variables, this will be an [InterfaceMirror]. 482 * class and interface variables, this will be a [ClassMirror].
459 */ 483 */
460 Mirror owner; 484 final Mirror owner;
461 485
462 /** 486 /**
463 * Does this mirror reflect a top-level variable? 487 * Does this mirror reflect a top-level variable?
464 */ 488 */
465 bool isTopLevel; 489 final bool isTopLevel;
466 490
467 /** 491 /**
468 * Does this mirror reflect a static variable? 492 * Does this mirror reflect a static variable?
469 * 493 *
470 * For the purposes of the mirror library, top-level variables are 494 * For the purposes of the mirror library, top-level variables are
471 * implicitly declared static. 495 * implicitly declared static.
472 */ 496 */
473 bool isStatic; 497 final bool isStatic;
474 498
475 /** 499 /**
476 * Does this mirror reflect a final variable? 500 * Does this mirror reflect a final variable?
477 */ 501 */
478 bool isFinal; 502 final bool isFinal;
479 } 503 }
480 504
481 505
482 /** 506 /**
483 * When an error occurs during the mirrored execution of code, a 507 * When an error occurs during the mirrored execution of code, a
484 * [MirroredError] is thrown. 508 * [MirroredError] is thrown.
485 * 509 *
486 * In general, there are three main classes of failure that can happen 510 * In general, there are three main classes of failure that can happen
487 * during mirrored execution of code in some isolate: 511 * during mirrored execution of code in some isolate:
488 * 512 *
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 577
554 /** 578 /**
555 * A [MirrorException] is used to indicate errors within the mirrors 579 * A [MirrorException] is used to indicate errors within the mirrors
556 * framework. 580 * framework.
557 */ 581 */
558 class MirrorException implements Exception { 582 class MirrorException implements Exception {
559 const MirrorException(String this._message); 583 const MirrorException(String this._message);
560 String toString() => "MirrorException: '$_message'"; 584 String toString() => "MirrorException: '$_message'";
561 final String _message; 585 final String _message;
562 } 586 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors.cc » ('j') | runtime/tests/vm/dart/isolate_mirror_local_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698