| 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 // The dart:mirrors library provides reflective access for Dart program. | 7 // The dart:mirrors library provides reflective access for Dart program. |
| 8 // | 8 // |
| 9 // For the purposes of the mirrors library, we adopt a naming | 9 // For the purposes of the mirrors library, we adopt a naming |
| 10 // convention with respect to getters and setters. Specifically, for | 10 // convention with respect to getters and setters. Specifically, for |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 /** | 100 /** |
| 101 * An [InstanceMirror] reflects an instance of a Dart language object. | 101 * An [InstanceMirror] reflects an instance of a Dart language object. |
| 102 */ | 102 */ |
| 103 interface InstanceMirror extends ObjectMirror { | 103 interface InstanceMirror extends ObjectMirror { |
| 104 /** | 104 /** |
| 105 * Returns a mirror on the class of the reflectee. | 105 * Returns a mirror on the class of the reflectee. |
| 106 */ | 106 */ |
| 107 InterfaceMirror getClass(); | 107 InterfaceMirror getClass(); |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * Does [simpleValue] contain the value of the reflectee? | 110 * Does [reflectee] contain the instance reflected by this mirror? This will |
| 111 */ | 111 * always be true in the local case (reflecting instances in the same |
| 112 bool hasSimpleValue; | 112 * isolate), but only true in the remote case if this mirror reflects a |
| 113 | 113 * simple value. |
| 114 /** | |
| 115 * If the [InstanceMirror] refers to a simple value, we provide | |
| 116 * access to the actual value here. | |
| 117 * | 114 * |
| 118 * A value is simple if one of the following holds: | 115 * A value is simple if one of the following holds: |
| 119 * - the value is null | 116 * - the value is null |
| 120 * - the value is of type [num] | 117 * - the value is of type [num] |
| 121 * - the value is of type [bool] | 118 * - the value is of type [bool] |
| 122 * - the value is of type [String] | 119 * - the value is of type [String] |
| 120 */ |
| 121 final bool hasReflectee; |
| 122 |
| 123 /** |
| 124 * If the [InstanceMirror] reflects an instance it is meaningful to have a |
| 125 * local reference to, we provide access to the actual instance here. |
| 123 * | 126 * |
| 124 * If you access [simpleValue] when [hasSimpleValue] is false an | 127 * If you access [reflectee] when [hasReflectee] is false, an |
| 125 * exception is thrown. | 128 * exception is thrown. |
| 126 */ | 129 */ |
| 127 final simpleValue; | 130 final reflectee; |
| 128 } | 131 } |
| 129 | 132 |
| 130 /** | 133 /** |
| 131 * An [InterfaceMirror] reflects a Dart language class or interface. | 134 * An [InterfaceMirror] reflects a Dart language class or interface. |
| 132 */ | 135 */ |
| 133 interface InterfaceMirror extends ObjectMirror { | 136 interface InterfaceMirror extends ObjectMirror { |
| 134 /** | 137 /** |
| 135 * The name of this interface. | 138 * The name of this interface. |
| 136 */ | 139 */ |
| 137 final String simpleName; | 140 final String simpleName; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 438 |
| 436 /** | 439 /** |
| 437 * A [MirrorException] is used to indicate errors within the mirrors | 440 * A [MirrorException] is used to indicate errors within the mirrors |
| 438 * framework. | 441 * framework. |
| 439 */ | 442 */ |
| 440 class MirrorException implements Exception { | 443 class MirrorException implements Exception { |
| 441 const MirrorException(String this._message); | 444 const MirrorException(String this._message); |
| 442 String toString() => "MirrorException: '$_message'"; | 445 String toString() => "MirrorException: '$_message'"; |
| 443 final String _message; | 446 final String _message; |
| 444 } | 447 } |
| OLD | NEW |