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 // 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 /** | 175 /** |
| 176 * Invokes the named function and returns a mirror on the result. | 176 * Invokes the named function and returns a mirror on the result. |
| 177 * The arguments must be InstanceMirrors, numbers, strings | |
| 178 * or booleans. | |
| 177 * | 179 * |
| 178 * TODO(turnidge): Properly document. | 180 * TODO(turnidge): Properly document. |
| 179 * TODO(turnidge): Handle ambiguous names. | 181 * TODO(turnidge): Handle ambiguous names. |
| 180 * TODO(turnidge): Handle optional & named arguments. | 182 * TODO(turnidge): Handle optional & named arguments. |
| 181 */ | 183 */ |
| 182 Future<InstanceMirror> invoke(String memberName, | 184 Future<InstanceMirror> invokeAsync(String memberName, |
| 183 List<Object> positionalArguments, | 185 List<Object> positionalArguments, |
|
Ivan Posva
2013/04/10 00:30:10
Indentation.
| |
| 184 [Map<String,Object> namedArguments]); | 186 [Map<String,Object> namedArguments]); |
| 185 | 187 |
| 186 /** | 188 /** |
| 187 * Invokes a getter and returns a mirror on the result. The getter | 189 * Invokes a getter and returns a mirror on the result. The getter |
| 188 * can be the implicit getter for a field or a user-defined getter | 190 * can be the implicit getter for a field or a user-defined getter |
| 189 * method. | 191 * method. |
| 190 * | 192 * |
| 191 * TODO(turnidge): Handle ambiguous names. | 193 * TODO(turnidge): Handle ambiguous names. |
| 192 */ | 194 */ |
| 193 Future<InstanceMirror> getField(String fieldName); | 195 Future<InstanceMirror> getFieldAsync(String fieldName); |
| 194 | 196 |
| 195 /** | 197 /** |
| 196 * Invokes a setter and returns a mirror on the result. The setter | 198 * Invokes a setter and returns a mirror on the result. The setter |
| 197 * may be either the implicit setter for a non-final field or a | 199 * may be either the implicit setter for a non-final field or a |
| 198 * user-defined setter method. | 200 * user-defined setter method. |
| 201 * The argument must be either an InstanceMirrors, a number, a string | |
|
Ivan Posva
2013/04/10 00:30:10
InstanceMirror minus the s.
| |
| 202 * or a boolean. | |
| 199 * | 203 * |
| 200 * TODO(turnidge): Handle ambiguous names. | 204 * TODO(turnidge): Handle ambiguous names. |
| 201 */ | 205 */ |
| 202 Future<InstanceMirror> setField(String fieldName, Object value); | 206 Future<InstanceMirror> setFieldAsync(String fieldName, Object value); |
| 203 } | 207 } |
| 204 | 208 |
| 205 /** | 209 /** |
| 206 * An [InstanceMirror] reflects an instance of a Dart language object. | 210 * An [InstanceMirror] reflects an instance of a Dart language object. |
| 207 */ | 211 */ |
| 208 abstract class InstanceMirror implements ObjectMirror { | 212 abstract class InstanceMirror implements ObjectMirror { |
| 209 /** | 213 /** |
| 210 * A mirror on the type of the reflectee. | 214 * A mirror on the type of the reflectee. |
| 211 */ | 215 */ |
| 212 ClassMirror get type; | 216 ClassMirror get type; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 /** | 262 /** |
| 259 * Executes the closure. The arguments given in the descriptor need to | 263 * Executes the closure. The arguments given in the descriptor need to |
| 260 * be InstanceMirrors or simple values. | 264 * be InstanceMirrors or simple values. |
| 261 * | 265 * |
| 262 * A value is simple if one of the following holds: | 266 * A value is simple if one of the following holds: |
| 263 * - the value is null | 267 * - the value is null |
| 264 * - the value is of type [num] | 268 * - the value is of type [num] |
| 265 * - the value is of type [bool] | 269 * - the value is of type [bool] |
| 266 * - the value is of type [String] | 270 * - the value is of type [String] |
| 267 */ | 271 */ |
| 268 Future<InstanceMirror> apply(List<Object> positionalArguments, | 272 Future<InstanceMirror> applyAsync(List<Object> positionalArguments, |
| 269 [Map<String,Object> namedArguments]); | 273 [Map<String,Object> namedArguments]); |
|
Ivan Posva
2013/04/10 00:30:10
Indentation.
| |
| 270 | 274 |
| 271 /** | 275 /** |
| 272 * Looks up the value of a name in the scope of the closure. The | 276 * Looks up the value of a name in the scope of the closure. The |
| 273 * result is a mirror on that value. | 277 * result is a mirror on that value. |
| 274 */ | 278 */ |
| 275 Future<InstanceMirror> findInContext(String name); | 279 Future<InstanceMirror> findInContext(String name); |
| 276 } | 280 } |
| 277 | 281 |
| 278 /** | 282 /** |
| 279 * A [LibraryMirror] reflects a Dart language library, providing | 283 * A [LibraryMirror] reflects a Dart language library, providing |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 429 * For most classes, they are their own original declaration. For | 433 * For most classes, they are their own original declaration. For |
| 430 * generic classes, however, there is a distinction between the | 434 * generic classes, however, there is a distinction between the |
| 431 * original class declaration, which has unbound type variables, and | 435 * original class declaration, which has unbound type variables, and |
| 432 * the instantiations of generic classes, which have bound type | 436 * the instantiations of generic classes, which have bound type |
| 433 * variables. | 437 * variables. |
| 434 */ | 438 */ |
| 435 ClassMirror get originalDeclaration; | 439 ClassMirror get originalDeclaration; |
| 436 | 440 |
| 437 /** | 441 /** |
| 438 * Invokes the named constructor and returns a mirror on the result. | 442 * Invokes the named constructor and returns a mirror on the result. |
| 443 * The arguments must be InstanceMirrors, numbers, strings | |
| 444 * or booleans. | |
| 439 * | 445 * |
| 440 * TODO(turnidge): Properly document. | 446 * TODO(turnidge): Properly document. |
| 441 */ | 447 */ |
| 442 Future<InstanceMirror> newInstance(String constructorName, | 448 Future<InstanceMirror> newInstanceAsync(String constructorName, |
| 443 List<Object> positionalArguments, | 449 List<Object> positionalArguments, |
|
Ivan Posva
2013/04/10 00:30:10
ditto
| |
| 444 [Map<String,Object> namedArguments]); | 450 [Map<String,Object> namedArguments]); |
| 445 | 451 |
| 446 /** | 452 /** |
| 447 * Does this mirror represent a class? | 453 * Does this mirror represent a class? |
| 448 * | 454 * |
| 449 * TODO(turnidge): This functions goes away after the | 455 * TODO(turnidge): This functions goes away after the |
| 450 * class/interface changes. | 456 * class/interface changes. |
| 451 */ | 457 */ |
| 452 bool get isClass; | 458 bool get isClass; |
| 453 | 459 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 /** | 765 /** |
| 760 * Is [:true:] if this comment is a documentation comment. | 766 * Is [:true:] if this comment is a documentation comment. |
| 761 * | 767 * |
| 762 * That is, that the comment is either enclosed in [: /** ... */ :] or starts | 768 * That is, that the comment is either enclosed in [: /** ... */ :] or starts |
| 763 * with [: /// :]. | 769 * with [: /// :]. |
| 764 */ | 770 */ |
| 765 final bool isDocComment; | 771 final bool isDocComment; |
| 766 | 772 |
| 767 const Comment(this.text, this.trimmedText, this.isDocComment); | 773 const Comment(this.text, this.trimmedText, this.isDocComment); |
| 768 } | 774 } |
| OLD | NEW |