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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart

Issue 11571058: DeclarationMirror extended with metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comment. Created 7 years, 11 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; 5 library mirrors;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:uri'; 8 import 'dart:uri';
9 9
10 // TODO(rnystrom): Use "package:" URL (#4968). 10 // TODO(rnystrom): Use "package:" URL (#4968).
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 TypeMirror get voidType; 68 TypeMirror get voidType;
69 } 69 }
70 70
71 71
72 /** 72 /**
73 * An entity in the mirror system. 73 * An entity in the mirror system.
74 */ 74 */
75 abstract class Mirror { 75 abstract class Mirror {
76 static const String UNARY_MINUS = 'unary-'; 76 static const String UNARY_MINUS = 'unary-';
77 77
78 // TODO(johnniwinther): Do we need this on all mirrors?
78 /** 79 /**
79 * Returns the mirror system which contains this mirror. 80 * Returns the mirror system which contains this mirror.
80 */ 81 */
81 MirrorSystem get mirrors; 82 MirrorSystem get mirrors;
82 } 83 }
83 84
84 abstract class DeclarationMirror implements Mirror { 85 abstract class DeclarationMirror implements Mirror {
85 /** 86 /**
86 * The simple name of the entity. The simple name is unique within the 87 * The simple name of the entity. The simple name is unique within the
87 * scope of the entity declaration. 88 * scope of the entity declaration.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 */ 134 */
134 bool get isPrivate; 135 bool get isPrivate;
135 136
136 /** 137 /**
137 * Is this declaration top-level? 138 * Is this declaration top-level?
138 * 139 *
139 * This is defined to be equivalent to: 140 * This is defined to be equivalent to:
140 * [:mirror.owner != null && mirror.owner is LibraryMirror:] 141 * [:mirror.owner != null && mirror.owner is LibraryMirror:]
141 */ 142 */
142 bool get isTopLevel; 143 bool get isTopLevel;
144
145 /**
146 * A list of the metadata associated with this declaration.
147 */
148 List<InstanceMirror> get metadata;
149 }
150
151 abstract class ObjectMirror implements Mirror {
152 /**
153 * Invokes a getter and returns a mirror on the result. The getter
154 * can be the implicit getter for a field or a user-defined getter
155 * method.
156 */
157 Future<InstanceMirror> getField(String fieldName);
143 } 158 }
144 159
145 /** 160 /**
161 * An [InstanceMirror] reflects an instance of a Dart language object.
162 */
163 abstract class InstanceMirror implements ObjectMirror {
164 /**
165 * A mirror on the type of the reflectee.
166 */
167 ClassMirror get type;
168
169 /**
170 * Does [reflectee] contain the instance reflected by this mirror?
171 * This will always be true in the local case (reflecting instances
172 * in the same isolate), but only true in the remote case if this
173 * mirror reflects a simple value.
174 *
175 * A value is simple if one of the following holds:
176 * - the value is null
177 * - the value is of type [num]
178 * - the value is of type [bool]
179 * - the value is of type [String]
180 */
181 bool get hasReflectee;
182
183 /**
184 * If the [InstanceMirror] reflects an instance it is meaningful to
185 * have a local reference to, we provide access to the actual
186 * instance here.
187 *
188 * If you access [reflectee] when [hasReflectee] is false, an
189 * exception is thrown.
190 */
191 get reflectee;
192 }
193
194 /**
195 * Specialized [InstanceMirror] used for reflection on constant lists.
196 */
197 abstract class ListInstanceMirror
198 implements InstanceMirror, Sequence<Future<InstanceMirror>> {
199
200 }
201
202 /**
203 * Specialized [InstanceMirror] used for reflection on constant maps.
204 */
205 abstract class MapInstanceMirror implements InstanceMirror {
206 /**
207 * Returns a collection containing all the keys in the map.
208 */
209 Collection<String> get keys;
210
211 /**
212 * Returns a future on the instance mirror of the value for the given key or
213 * null if key is not in the map.
214 */
215 Future<InstanceMirror> operator[](String key);
216
217 /**
218 * The number of {key, value} pairs in the map.
219 */
220 int get length;
221 }
222
223 /**
224 * Specialized [InstanceMirror] used for reflection on type constants.
225 */
226 abstract class TypeInstanceMirror implements InstanceMirror {
227 /**
228 * Returns the type mirror for the type represented by the reflected type
229 * constant.
230 */
231 TypeMirror get representedType;
232 }
233
234 /**
146 * Common interface for classes and libraries. 235 * Common interface for classes and libraries.
147 */ 236 */
148 abstract class ContainerMirror implements Mirror { 237 abstract class ContainerMirror implements Mirror {
149 238
150 /** 239 /**
151 * An immutable map from from names to mirrors for all members in this 240 * An immutable map from from names to mirrors for all members in this
152 * container. 241 * container.
153 */ 242 */
154 Map<String, MemberMirror> get members; 243 Map<String, MemberMirror> get members;
155 } 244 }
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 /** 702 /**
614 * Returns the URI where the source originated. 703 * Returns the URI where the source originated.
615 */ 704 */
616 Uri get sourceUri; 705 Uri get sourceUri;
617 706
618 /** 707 /**
619 * Returns the text of this source. 708 * Returns the text of this source.
620 */ 709 */
621 String get sourceText; 710 String get sourceText;
622 } 711 }
712
713 /**
714 * Class used for encoding dartdoc comments as metadata annotations.
715 */
716 class DartdocComment {
717 final String text;
718
719 const DartdocComment(this.text);
720 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart ('k') | tests/compiler/dart2js/mirrors_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698