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

Side by Side Diff: pkg/dartdoc/mirrors/mirrors.dart

Issue 10928139: Changed interfaces to abstract classes where possible in {lib,samples,pkg} (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 #import('dart2js_mirror.dart'); 9 #import('dart2js_mirror.dart');
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 /** 43 /**
44 * Returns a future for the compiled JavaScript code. 44 * Returns a future for the compiled JavaScript code.
45 */ 45 */
46 abstract Future<String> compileToJavaScript(); 46 abstract Future<String> compileToJavaScript();
47 } 47 }
48 48
49 /** 49 /**
50 * The main interface for the whole mirror system. 50 * The main interface for the whole mirror system.
51 */ 51 */
52 interface MirrorSystem { 52 abstract class MirrorSystem {
53 /** 53 /**
54 * Returns an unmodifiable map of all libraries in this mirror system. 54 * Returns an unmodifiable map of all libraries in this mirror system.
55 */ 55 */
56 final Map<Object, LibraryMirror> libraries; 56 Map<Object, LibraryMirror> get libraries;
57 } 57 }
58 58
59 59
60 /** 60 /**
61 * An entity in the mirror system. 61 * An entity in the mirror system.
62 */ 62 */
63 interface Mirror extends Hashable { 63 abstract class Mirror implements Hashable {
64 /** 64 /**
65 * The simple name of the entity. The simple name is in most cases the 65 * The simple name of the entity. The simple name is in most cases the
66 * the declared single identifier name of the entity, such as 'method' for 66 * the declared single identifier name of the entity, such as 'method' for
67 * a method [:void method() {...}:]. 67 * a method [:void method() {...}:].
68 */ 68 */
69 final String simpleName; 69 String get simpleName;
70 70
71 /** 71 /**
72 * Returns the name of this entity qualified by is enclosing context. For 72 * Returns the name of this entity qualified by is enclosing context. For
73 * instance, the qualified name of a method 'method' in class 'Class' in 73 * instance, the qualified name of a method 'method' in class 'Class' in
74 * library 'library' is 'library.Class.method'. 74 * library 'library' is 'library.Class.method'.
75 */ 75 */
76 final String qualifiedName; 76 String get qualifiedName;
77 77
78 /** 78 /**
79 * Returns the mirror system which contains this mirror. 79 * Returns the mirror system which contains this mirror.
80 */ 80 */
81 final MirrorSystem system; 81 MirrorSystem get system;
82 } 82 }
83 83
84 /** 84 /**
85 * Common interface for interface types and libraries. 85 * Common interface for interface types and libraries.
86 */ 86 */
87 interface ObjectMirror extends Mirror { 87 abstract class ObjectMirror implements Mirror {
88 88
89 /** 89 /**
90 * Returns an unmodifiable map of the members of declared in this type or 90 * Returns an unmodifiable map of the members of declared in this type or
91 * library. 91 * library.
92 */ 92 */
93 final Map<Object, MemberMirror> declaredMembers; 93 Map<Object, MemberMirror> get declaredMembers;
94 } 94 }
95 95
96 /** 96 /**
97 * A library. 97 * A library.
98 */ 98 */
99 interface LibraryMirror extends ObjectMirror { 99 abstract class LibraryMirror extends ObjectMirror {
100 /** 100 /**
101 * The name of the library, as given in #library(). 101 * The name of the library, as given in #library().
102 */ 102 */
103 final String simpleName; 103 String get simpleName;
104 104
105 /** 105 /**
106 * Returns an iterable over all types in the library. 106 * Returns an iterable over all types in the library.
107 */ 107 */
108 final Map<Object, InterfaceMirror> types; 108 Map<Object, InterfaceMirror> get types;
109 109
110 /** 110 /**
111 * Returns the source location for this library. 111 * Returns the source location for this library.
112 */ 112 */
113 final Location location; 113 Location get location;
114 } 114 }
115 115
116 /** 116 /**
117 * Common interface for classes, interfaces, typedefs and type variables. 117 * Common interface for classes, interfaces, typedefs and type variables.
118 */ 118 */
119 interface TypeMirror extends Mirror { 119 abstract class TypeMirror implements Mirror {
120 /** 120 /**
121 * Returns the source location for this type. 121 * Returns the source location for this type.
122 */ 122 */
123 final Location location; 123 Location get location;
124 124
125 /** 125 /**
126 * Returns the library in which this member resides. 126 * Returns the library in which this member resides.
127 */ 127 */
128 final LibraryMirror library; 128 LibraryMirror get library;
129 129
130 /** 130 /**
131 * Is [:true:] iff this type is the [:Object:] type. 131 * Is [:true:] iff this type is the [:Object:] type.
132 */ 132 */
133 final bool isObject; 133 bool get isObject;
134 134
135 /** 135 /**
136 * Is [:true:] iff this type is the [:Dynamic:] type. 136 * Is [:true:] iff this type is the [:Dynamic:] type.
137 */ 137 */
138 final bool isDynamic; 138 bool get isDynamic;
139 139
140 /** 140 /**
141 * Is [:true:] iff this type is the void type. 141 * Is [:true:] iff this type is the void type.
142 */ 142 */
143 final bool isVoid; 143 bool get isVoid;
144 144
145 /** 145 /**
146 * Is [:true:] iff this type is a type variable. 146 * Is [:true:] iff this type is a type variable.
147 */ 147 */
148 final bool isTypeVariable; 148 bool get isTypeVariable;
149 149
150 /** 150 /**
151 * Is [:true:] iff this type is a typedef. 151 * Is [:true:] iff this type is a typedef.
152 */ 152 */
153 final bool isTypedef; 153 bool get isTypedef;
154 154
155 /** 155 /**
156 * Is [:true:] iff this type is a function type. 156 * Is [:true:] iff this type is a function type.
157 */ 157 */
158 final bool isFunction; 158 bool get isFunction;
159 } 159 }
160 160
161 /** 161 /**
162 * A class or interface type. 162 * A class or interface type.
163 */ 163 */
164 interface InterfaceMirror extends TypeMirror, ObjectMirror { 164 abstract class InterfaceMirror implements TypeMirror, ObjectMirror {
165 /** 165 /**
166 * Returns the defining type, i.e. declaration of a type. 166 * Returns the defining type, i.e. declaration of a type.
167 */ 167 */
168 final InterfaceMirror declaration; 168 InterfaceMirror get declaration;
169 169
170 /** 170 /**
171 * Returns the super class of this type, or null if this type is [Object] or a 171 * Returns the super class of this type, or null if this type is [Object] or a
172 * typedef. 172 * typedef.
173 */ 173 */
174 final InterfaceMirror superclass; 174 InterfaceMirror get superclass;
175 175
176 /** 176 /**
177 * Returns an iterable over the interfaces directly implemented by this type. 177 * Returns an iterable over the interfaces directly implemented by this type.
178 */ 178 */
179 final Map<Object, InterfaceMirror> interfaces; 179 Map<Object, InterfaceMirror> get interfaces;
180 180
181 /** 181 /**
182 * Is [:true:] iff this type is a class. 182 * Is [:true:] iff this type is a class.
183 */ 183 */
184 final bool isClass; 184 bool get isClass;
185 185
186 /** 186 /**
187 * Is [:true:] iff this type is an interface. 187 * Is [:true:] iff this type is an interface.
188 */ 188 */
189 final bool isInterface; 189 bool get isInterface;
190 190
191 /** 191 /**
192 * Is [:true:] if this type is private. 192 * Is [:true:] if this type is private.
193 */ 193 */
194 final bool isPrivate; 194 bool get isPrivate;
195 195
196 /** 196 /**
197 * Is [:true:] if this type is the declaration of a type. 197 * Is [:true:] if this type is the declaration of a type.
198 */ 198 */
199 final bool isDeclaration; 199 bool get isDeclaration;
200 200
201 /** 201 /**
202 * Returns a list of the type arguments for this type. 202 * Returns a list of the type arguments for this type.
203 */ 203 */
204 final List<TypeMirror> typeArguments; 204 List<TypeMirror> get typeArguments;
205 205
206 /** 206 /**
207 * Returns the list of type variables for this type. 207 * Returns the list of type variables for this type.
208 */ 208 */
209 final List<TypeVariableMirror> typeVariables; 209 List<TypeVariableMirror> get typeVariables;
210 210
211 /** 211 /**
212 * Returns an immutable map of the constructors in this interface. 212 * Returns an immutable map of the constructors in this interface.
213 */ 213 */
214 final Map<Object, MethodMirror> constructors; 214 Map<Object, MethodMirror> get constructors;
215 215
216 /** 216 /**
217 * Returns the default type for this interface. 217 * Returns the default type for this interface.
218 */ 218 */
219 final InterfaceMirror defaultType; 219 InterfaceMirror get defaultType;
220 } 220 }
221 221
222 /** 222 /**
223 * A type parameter as declared on a generic type. 223 * A type parameter as declared on a generic type.
224 */ 224 */
225 interface TypeVariableMirror extends TypeMirror { 225 abstract class TypeVariableMirror implements TypeMirror {
226 /** 226 /**
227 * Return a mirror on the class, interface, or typedef that declared the 227 * Return a mirror on the class, interface, or typedef that declared the
228 * type variable. 228 * type variable.
229 */ 229 */
230 // Should not be called [declaration] as we then would have two [TypeMirror] 230 // Should not be called [declaration] as we then would have two [TypeMirror]
231 // subtypes ([InterfaceMirror] and [TypeVariableMirror]) which have 231 // subtypes ([InterfaceMirror] and [TypeVariableMirror]) which have
232 // [declaration()] methods but with different semantics. 232 // [declaration()] methods but with different semantics.
233 final InterfaceMirror declarer; 233 InterfaceMirror get declarer;
234 234
235 /** 235 /**
236 * Returns the bound of the type parameter. 236 * Returns the bound of the type parameter.
237 */ 237 */
238 final TypeMirror bound; 238 TypeMirror get bound;
239 } 239 }
240 240
241 /** 241 /**
242 * A function type. 242 * A function type.
243 */ 243 */
244 interface FunctionTypeMirror extends InterfaceMirror { 244 abstract class FunctionTypeMirror implements InterfaceMirror {
245 /** 245 /**
246 * Returns the return type of this function type. 246 * Returns the return type of this function type.
247 */ 247 */
248 final TypeMirror returnType; 248 TypeMirror get returnType;
249 249
250 /** 250 /**
251 * Returns the parameters for this function type. 251 * Returns the parameters for this function type.
252 */ 252 */
253 final List<ParameterMirror> parameters; 253 List<ParameterMirror> get parameters;
254 254
255 /** 255 /**
256 * Returns the call method for this function type. 256 * Returns the call method for this function type.
257 */ 257 */
258 final MethodMirror callMethod; 258 MethodMirror get callMethod;
259 } 259 }
260 260
261 /** 261 /**
262 * A typedef. 262 * A typedef.
263 */ 263 */
264 interface TypedefMirror extends InterfaceMirror { 264 abstract class TypedefMirror implements InterfaceMirror {
265 /** 265 /**
266 * Returns the defining type for this typedef. For instance [:void f(int):] 266 * Returns the defining type for this typedef. For instance [:void f(int):]
267 * for a [:typedef void f(int):]. 267 * for a [:typedef void f(int):].
268 */ 268 */
269 final TypeMirror definition; 269 TypeMirror get definition;
270 } 270 }
271 271
272 /** 272 /**
273 * A member of a type, i.e. a field, method or constructor. 273 * A member of a type, i.e. a field, method or constructor.
274 */ 274 */
275 interface MemberMirror extends Mirror { 275 abstract class MemberMirror implements Mirror {
276 /** 276 /**
277 * Returns the source location for this member. 277 * Returns the source location for this member.
278 */ 278 */
279 final Location location; 279 Location get location;
280 280
281 /** 281 /**
282 * Returns a mirror on the declaration immediately surrounding the reflectee. 282 * Returns a mirror on the declaration immediately surrounding the reflectee.
283 * This could be a class, interface, library or another method or function. 283 * This could be a class, interface, library or another method or function.
284 */ 284 */
285 final ObjectMirror surroundingDeclaration; 285 ObjectMirror get surroundingDeclaration;
286 286
287 /** 287 /**
288 * Returns true if this is a top level member, i.e. a member not within a 288 * Returns true if this is a top level member, i.e. a member not within a
289 * type. 289 * type.
290 */ 290 */
291 final bool isTopLevel; 291 bool get isTopLevel;
292 292
293 /** 293 /**
294 * Returns true if this member is a constructor. 294 * Returns true if this member is a constructor.
295 */ 295 */
296 final bool isConstructor; 296 bool get isConstructor;
297 297
298 /** 298 /**
299 * Returns true if this member is a field. 299 * Returns true if this member is a field.
300 */ 300 */
301 final bool isField; 301 bool get isField;
302 302
303 /** 303 /**
304 * Returns true if this member is a method. 304 * Returns true if this member is a method.
305 */ 305 */
306 final bool isMethod; 306 bool get isMethod;
307 307
308 /** 308 /**
309 * Returns true if this member is private. 309 * Returns true if this member is private.
310 */ 310 */
311 final bool isPrivate; 311 bool get isPrivate;
312 312
313 /** 313 /**
314 * Returns true if this member is static. 314 * Returns true if this member is static.
315 */ 315 */
316 final bool isStatic; 316 bool get isStatic;
317 } 317 }
318 318
319 /** 319 /**
320 * A field. 320 * A field.
321 */ 321 */
322 interface FieldMirror extends MemberMirror { 322 abstract class FieldMirror implements MemberMirror {
323 323
324 /** 324 /**
325 * Returns true if this field is final. 325 * Returns true if this field is final.
326 */ 326 */
327 final bool isFinal; 327 bool get isFinal;
328 328
329 /** 329 /**
330 * Returns the type of this field. 330 * Returns the type of this field.
331 */ 331 */
332 final TypeMirror type; 332 TypeMirror get type;
333 } 333 }
334 334
335 /** 335 /**
336 * Common interface constructors and methods, including factories, getters and 336 * Common interface constructors and methods, including factories, getters and
337 * setters. 337 * setters.
338 */ 338 */
339 interface MethodMirror extends MemberMirror { 339 abstract class MethodMirror implements MemberMirror {
340 /** 340 /**
341 * Returns the list of parameters for this method. 341 * Returns the list of parameters for this method.
342 */ 342 */
343 final List<ParameterMirror> parameters; 343 List<ParameterMirror> get parameters;
344 344
345 /** 345 /**
346 * Returns the return type of this method. 346 * Returns the return type of this method.
347 */ 347 */
348 final TypeMirror returnType; 348 TypeMirror get returnType;
349 349
350 /** 350 /**
351 * Is [:true:] if this method is a constant constructor. 351 * Is [:true:] if this method is a constant constructor.
352 */ 352 */
353 final bool isConst; 353 bool get isConst;
354 354
355 /** 355 /**
356 * Is [:true:] if this method is a factory method. 356 * Is [:true:] if this method is a factory method.
357 */ 357 */
358 final bool isFactory; 358 bool get isFactory;
359 359
360 /** 360 /**
361 * Returns the constructor name for named constructors and factory methods, 361 * Returns the constructor name for named constructors and factory methods,
362 * e.g. [:'bar':] for constructor [:Foo.bar:] of type [:Foo:]. 362 * e.g. [:'bar':] for constructor [:Foo.bar:] of type [:Foo:].
363 */ 363 */
364 final String constructorName; 364 String get constructorName;
365 365
366 /** 366 /**
367 * Is [:true:] if this method is a getter method. 367 * Is [:true:] if this method is a getter method.
368 */ 368 */
369 final bool isGetter; 369 bool get isGetter;
370 370
371 /** 371 /**
372 * Is [:true:] if this method is a setter method. 372 * Is [:true:] if this method is a setter method.
373 */ 373 */
374 final bool isSetter; 374 bool get isSetter;
375 375
376 /** 376 /**
377 * Is [:true:] if this method is an operator method. 377 * Is [:true:] if this method is an operator method.
378 */ 378 */
379 final bool isOperator; 379 bool get isOperator;
380 380
381 /** 381 /**
382 * Returns the operator name for operator methods, e.g. [:'<':] for 382 * Returns the operator name for operator methods, e.g. [:'<':] for
383 * [:operator <:] 383 * [:operator <:]
384 */ 384 */
385 final String operatorName; 385 String get operatorName;
386 } 386 }
387 387
388 /** 388 /**
389 * A formal parameter. 389 * A formal parameter.
390 */ 390 */
391 interface ParameterMirror extends Mirror { 391 abstract class ParameterMirror implements Mirror {
392 /** 392 /**
393 * Returns the type of this parameter. 393 * Returns the type of this parameter.
394 */ 394 */
395 final TypeMirror type; 395 TypeMirror get type;
396 396
397 /** 397 /**
398 * Returns the default value for this parameter. 398 * Returns the default value for this parameter.
399 */ 399 */
400 final String defaultValue; 400 String get defaultValue;
401 401
402 /** 402 /**
403 * Returns true if this parameter has a default value. 403 * Returns true if this parameter has a default value.
404 */ 404 */
405 final bool hasDefaultValue; 405 bool get hasDefaultValue;
406 406
407 /** 407 /**
408 * Returns true if this parameter is optional. 408 * Returns true if this parameter is optional.
409 */ 409 */
410 final bool isOptional; 410 bool get isOptional;
411 411
412 /** 412 /**
413 * Returns [:true:] iff this parameter is an initializing formal of a 413 * Returns [:true:] iff this parameter is an initializing formal of a
414 * constructor. That is, if it is of the form [:this.x:] where [:x:] is a 414 * constructor. That is, if it is of the form [:this.x:] where [:x:] is a
415 * field. 415 * field.
416 */ 416 */
417 final bool isInitializingFormal; 417 bool get isInitializingFormal;
418 418
419 /** 419 /**
420 * Returns the initialized field, if this parameter is an initializing formal. 420 * Returns the initialized field, if this parameter is an initializing formal.
421 */ 421 */
422 final FieldMirror initializedField; 422 FieldMirror get initializedField;
423 } 423 }
424 424
425 /** 425 /**
426 * A [Location] describes the span of an entity in Dart source code. 426 * A [Location] describes the span of an entity in Dart source code.
427 * A [Location] should be the minimum span that encloses the declaration of the 427 * A [Location] should be the minimum span that encloses the declaration of the
428 * mirrored entity. 428 * mirrored entity.
429 */ 429 */
430 interface Location { 430 abstract class Location {
431 /** 431 /**
432 * The character position where the location begins. 432 * The character position where the location begins.
433 */ 433 */
434 final int start; 434 int get start;
435 435
436 /** 436 /**
437 * The character position where the location ends. 437 * The character position where the location ends.
438 */ 438 */
439 final int end; 439 int get end;
440 440
441 /** 441 /**
442 * Returns the [Source] in which this [Location] indexes. 442 * Returns the [Source] in which this [Location] indexes.
443 * If [:loc:] is a location, [:loc.source().text()[loc.start()] is where it 443 * If [:loc:] is a location, [:loc.source().text()[loc.start()] is where it
444 * starts, and [:loc.source().text()[loc.end()] is where it ends. 444 * starts, and [:loc.source().text()[loc.end()] is where it ends.
445 */ 445 */
446 final Source source; 446 Source get source;
447 447
448 /** 448 /**
449 * The text of the location span. 449 * The text of the location span.
450 */ 450 */
451 final String text; 451 String get text;
452 } 452 }
453 453
454 /** 454 /**
455 * A [Source] describes the source code of a compilation unit in Dart source 455 * A [Source] describes the source code of a compilation unit in Dart source
456 * code. 456 * code.
457 */ 457 */
458 interface Source { 458 abstract class Source {
459 /** 459 /**
460 * Returns the URI where the source originated. 460 * Returns the URI where the source originated.
461 */ 461 */
462 final Uri uri; 462 Uri get uri;
463 463
464 /** 464 /**
465 * Returns the text of this source. 465 * Returns the text of this source.
466 */ 466 */
467 final String text; 467 String get text;
468 } 468 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698