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 // For the purposes of the mirrors library, we adopt a naming | 5 // For the purposes of the mirrors library, we adopt a naming |
6 // convention with respect to getters and setters. Specifically, for | 6 // convention with respect to getters and setters. Specifically, for |
7 // some variable or field... | 7 // some variable or field... |
8 // | 8 // |
9 // var myField; | 9 // var myField; |
10 // | 10 // |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 * functionality. | 165 * functionality. |
166 * | 166 * |
167 * For the purposes of the mirrors library, these types are all | 167 * For the purposes of the mirrors library, these types are all |
168 * object-like, in that they support method invocation and field | 168 * object-like, in that they support method invocation and field |
169 * access. Real Dart objects are represented by the [InstanceMirror] | 169 * access. Real Dart objects are represented by the [InstanceMirror] |
170 * type. | 170 * type. |
171 * | 171 * |
172 * See [InstanceMirror], [ClassMirror], and [LibraryMirror]. | 172 * See [InstanceMirror], [ClassMirror], and [LibraryMirror]. |
173 */ | 173 */ |
174 abstract class ObjectMirror implements Mirror { | 174 abstract class ObjectMirror implements Mirror { |
| 175 |
| 176 /** |
| 177 * Invokes the named function and returns a mirror on the result. |
| 178 * The arguments are objects local to the current isolate. |
| 179 */ |
| 180 /* TODO(turnidge): Properly document. |
| 181 * TODO(turnidge): Handle ambiguous names. |
| 182 * TODO(turnidge): Handle optional & named arguments. |
| 183 */ |
| 184 InstanceMirror invoke(String memberName, |
| 185 List positionalArguments, |
| 186 [Map<String,dynamic> namedArguments]); |
| 187 |
| 188 /** |
| 189 * Invokes a getter and returns a mirror on the result. The getter |
| 190 * can be the implicit getter for a field or a user-defined getter |
| 191 * method. |
| 192 */ |
| 193 /* TODO(turnidge): Handle ambiguous names.*/ |
| 194 InstanceMirror getField(String fieldName); |
| 195 |
| 196 /** |
| 197 * Invokes a setter and returns a mirror on the result. The setter |
| 198 * may be either the implicit setter for a non-final field or a |
| 199 * user-defined setter method. |
| 200 * The argument is an object local to the current isolate. |
| 201 */ |
| 202 /* TODO(turnidge): Handle ambiguous names.*/ |
| 203 InstanceMirror setField(String fieldName, Object arg); |
| 204 |
175 /** | 205 /** |
176 * Invokes the named function and returns a mirror on the result. | 206 * Invokes the named function and returns a mirror on the result. |
177 * The arguments must be instances of [InstanceMirror], [num], | 207 * The arguments must be instances of [InstanceMirror], [num], |
178 * [String] or [bool]. | 208 * [String] or [bool]. |
179 */ | 209 */ |
180 /* TODO(turnidge): Properly document. | 210 /* TODO(turnidge): Properly document. |
181 * TODO(turnidge): Handle ambiguous names. | 211 * TODO(turnidge): Handle ambiguous names. |
182 * TODO(turnidge): Handle optional & named arguments. | 212 * TODO(turnidge): Handle optional & named arguments. |
183 */ | 213 */ |
184 Future<InstanceMirror> invokeAsync(String memberName, | 214 Future<InstanceMirror> invokeAsync(String memberName, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 282 |
253 /** | 283 /** |
254 * The source code for this closure, if available. Otherwise null. | 284 * The source code for this closure, if available. Otherwise null. |
255 * | 285 * |
256 * TODO(turnidge): Would this just be available in function? | 286 * TODO(turnidge): Would this just be available in function? |
257 */ | 287 */ |
258 String get source; | 288 String get source; |
259 | 289 |
260 /** | 290 /** |
261 * Executes the closure. | 291 * Executes the closure. |
| 292 * The arguments are objects local to the current isolate. |
| 293 */ |
| 294 InstanceMirror apply(List<Object> positionalArguments, |
| 295 [Map<String,Object> namedArguments]); |
| 296 |
| 297 /** |
| 298 * Executes the closure. |
262 * The arguments must be instances of [InstanceMirror], [num], | 299 * The arguments must be instances of [InstanceMirror], [num], |
263 * [String] or [bool]. | 300 * [String] or [bool]. |
264 */ | 301 */ |
265 Future<InstanceMirror> applyAsync(List<Object> positionalArguments, | 302 Future<InstanceMirror> applyAsync(List<Object> positionalArguments, |
266 [Map<String,Object> namedArguments]); | 303 [Map<String,Object> namedArguments]); |
267 | 304 |
268 /** | 305 /** |
269 * Looks up the value of a name in the scope of the closure. The | 306 * Looks up the value of a name in the scope of the closure. The |
270 * result is a mirror on that value. | 307 * result is a mirror on that value. |
271 */ | 308 */ |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 * For most classes, they are their own original declaration. For | 463 * For most classes, they are their own original declaration. For |
427 * generic classes, however, there is a distinction between the | 464 * generic classes, however, there is a distinction between the |
428 * original class declaration, which has unbound type variables, and | 465 * original class declaration, which has unbound type variables, and |
429 * the instantiations of generic classes, which have bound type | 466 * the instantiations of generic classes, which have bound type |
430 * variables. | 467 * variables. |
431 */ | 468 */ |
432 ClassMirror get originalDeclaration; | 469 ClassMirror get originalDeclaration; |
433 | 470 |
434 /** | 471 /** |
435 * Invokes the named constructor and returns a mirror on the result. | 472 * Invokes the named constructor and returns a mirror on the result. |
436 * The arguments must be instances of [InstanceMirror], [num], | 473 * The arguments are objects local to the current isolate |
| 474 */ |
| 475 /* TODO(turnidge): Properly document.*/ |
| 476 InstanceMirror newInstance(String constructorName, |
| 477 List positionalArguments, |
| 478 [Map<String,dynamic> namedArguments]); |
| 479 |
| 480 /** |
| 481 * Invokes the named constructor and returns a mirror on the result. |
| 482 * The arguments must be instances of [InstanceMirror], [num], |
| 483 * [String] or [bool]. |
437 */ | 484 */ |
438 /* TODO(turnidge): Properly document.*/ | 485 /* TODO(turnidge): Properly document.*/ |
439 Future<InstanceMirror> newInstanceAsync(String constructorName, | 486 Future<InstanceMirror> newInstanceAsync(String constructorName, |
440 List<Object> positionalArguments, | 487 List<Object> positionalArguments, |
441 [Map<String,Object> namedArguments]); | 488 [Map<String,Object> namedArguments]); |
442 | 489 |
443 /** | 490 /** |
444 * Does this mirror represent a class? | 491 * Does this mirror represent a class? |
445 * | 492 * |
446 * TODO(turnidge): This functions goes away after the | 493 * TODO(turnidge): This functions goes away after the |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 /** | 803 /** |
757 * Is [:true:] if this comment is a documentation comment. | 804 * Is [:true:] if this comment is a documentation comment. |
758 * | 805 * |
759 * That is, that the comment is either enclosed in [: /** ... */ :] or starts | 806 * That is, that the comment is either enclosed in [: /** ... */ :] or starts |
760 * with [: /// :]. | 807 * with [: /// :]. |
761 */ | 808 */ |
762 final bool isDocComment; | 809 final bool isDocComment; |
763 | 810 |
764 const Comment(this.text, this.trimmedText, this.isDocComment); | 811 const Comment(this.text, this.trimmedText, this.isDocComment); |
765 } | 812 } |
OLD | NEW |