| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:uri'; | 8 import 'dart:uri'; |
| 9 | 9 |
| 10 // TODO(rnystrom): Use "package:" URL (#4968). | |
| 11 import 'dart2js_mirror.dart'; | |
| 12 | |
| 13 /** | 10 /** |
| 14 * The main interface for the whole mirror system. | 11 * The main interface for the whole mirror system. |
| 15 */ | 12 */ |
| 16 abstract class MirrorSystem { | 13 abstract class MirrorSystem { |
| 17 /** | 14 /** |
| 18 * Returns an unmodifiable map of all libraries in this mirror system. | 15 * Returns an unmodifiable map of all libraries in this mirror system. |
| 19 */ | 16 */ |
| 20 Map<Uri, LibraryMirror> get libraries; | 17 Map<Uri, LibraryMirror> get libraries; |
| 21 | 18 |
| 22 /** | 19 /** |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 */ | 115 */ |
| 119 List<InstanceMirror> get metadata; | 116 List<InstanceMirror> get metadata; |
| 120 } | 117 } |
| 121 | 118 |
| 122 abstract class ObjectMirror implements Mirror { | 119 abstract class ObjectMirror implements Mirror { |
| 123 /** | 120 /** |
| 124 * Invokes a getter and returns a mirror on the result. The getter | 121 * Invokes a getter and returns a mirror on the result. The getter |
| 125 * can be the implicit getter for a field or a user-defined getter | 122 * can be the implicit getter for a field or a user-defined getter |
| 126 * method. | 123 * method. |
| 127 */ | 124 */ |
| 128 Future<InstanceMirror> getField(String fieldName); | 125 InstanceMirror getField(String fieldName); |
| 129 } | 126 } |
| 130 | 127 |
| 131 /** | 128 /** |
| 132 * An [InstanceMirror] reflects an instance of a Dart language object. | 129 * An [InstanceMirror] reflects an instance of a Dart language object. |
| 133 */ | 130 */ |
| 134 abstract class InstanceMirror implements ObjectMirror { | 131 abstract class InstanceMirror implements ObjectMirror { |
| 135 /** | 132 /** |
| 136 * A mirror on the type of the reflectee. | 133 * A mirror on the type of the reflectee. |
| 137 */ | 134 */ |
| 138 ClassMirror get type; | 135 ClassMirror get type; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 159 * If you access [reflectee] when [hasReflectee] is false, an | 156 * If you access [reflectee] when [hasReflectee] is false, an |
| 160 * exception is thrown. | 157 * exception is thrown. |
| 161 */ | 158 */ |
| 162 get reflectee; | 159 get reflectee; |
| 163 } | 160 } |
| 164 | 161 |
| 165 /** | 162 /** |
| 166 * Specialized [InstanceMirror] used for reflection on constant lists. | 163 * Specialized [InstanceMirror] used for reflection on constant lists. |
| 167 */ | 164 */ |
| 168 abstract class ListInstanceMirror implements InstanceMirror { | 165 abstract class ListInstanceMirror implements InstanceMirror { |
| 169 Future<InstanceMirror> operator[](int index); | 166 /** |
| 167 * Returns an instance mirror of the value at [index] or throws a [RangeError] |
| 168 * if the [index] is out of bounds. |
| 169 */ |
| 170 InstanceMirror operator[](int index); |
| 171 |
| 172 /** |
| 173 * The number of elements in the list. |
| 174 */ |
| 170 int get length; | 175 int get length; |
| 171 } | 176 } |
| 172 | 177 |
| 173 /** | 178 /** |
| 174 * Specialized [InstanceMirror] used for reflection on constant maps. | 179 * Specialized [InstanceMirror] used for reflection on constant maps. |
| 175 */ | 180 */ |
| 176 abstract class MapInstanceMirror implements InstanceMirror { | 181 abstract class MapInstanceMirror implements InstanceMirror { |
| 177 /** | 182 /** |
| 178 * Returns a collection containing all the keys in the map. | 183 * Returns a collection containing all the keys in the map. |
| 179 */ | 184 */ |
| 180 Iterable<String> get keys; | 185 Iterable<String> get keys; |
| 181 | 186 |
| 182 /** | 187 /** |
| 183 * Returns a future on the instance mirror of the value for the given key or | 188 * Returns an instance mirror of the value for the given key or |
| 184 * null if key is not in the map. | 189 * null if key is not in the map. |
| 185 */ | 190 */ |
| 186 Future<InstanceMirror> operator[](String key); | 191 InstanceMirror operator[](String key); |
| 187 | 192 |
| 188 /** | 193 /** |
| 189 * The number of {key, value} pairs in the map. | 194 * The number of {key, value} pairs in the map. |
| 190 */ | 195 */ |
| 191 int get length; | 196 int get length; |
| 192 } | 197 } |
| 193 | 198 |
| 194 /** | 199 /** |
| 195 * Specialized [InstanceMirror] used for reflection on type constants. | 200 * Specialized [InstanceMirror] used for reflection on type constants. |
| 196 */ | 201 */ |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 /** | 704 /** |
| 700 * Returns the URI where the source originated. | 705 * Returns the URI where the source originated. |
| 701 */ | 706 */ |
| 702 Uri get sourceUri; | 707 Uri get sourceUri; |
| 703 | 708 |
| 704 /** | 709 /** |
| 705 * Returns the text of this source. | 710 * Returns the text of this source. |
| 706 */ | 711 */ |
| 707 String get sourceText; | 712 String get sourceText; |
| 708 } | 713 } |
| OLD | NEW |