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

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

Issue 11338031: Introduce DeclarationMirror (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 61
62 /** 62 /**
63 * An entity in the mirror system. 63 * An entity in the mirror system.
64 */ 64 */
65 abstract class Mirror { 65 abstract class Mirror {
66 static const String UNARY_MINUS = 'unary-'; 66 static const String UNARY_MINUS = 'unary-';
67 67
68 /** 68 /**
69 * Returns the mirror system which contains this mirror.
70 */
71 MirrorSystem get system;
72 }
73
74 abstract class DeclarationMirror implements Mirror {
75 /**
69 * The simple name of the entity. The simple name is unique within the 76 * The simple name of the entity. The simple name is unique within the
70 * scope of the entity declaration. 77 * scope of the entity declaration.
71 * 78 *
72 * The simple name is in most cases the declared single identifier name of 79 * The simple name is in most cases the declared single identifier name of
73 * the entity, such as 'method' for a method [:void method() {...}:]. For an 80 * the entity, such as 'method' for a method [:void method() {...}:]. For an
74 * unnamed constructor for [:class Foo:] the simple name is 'Foo'. For a 81 * unnamed constructor for [:class Foo:] the simple name is 'Foo'. For a
75 * constructor for [:class Foo:] named 'named' the simple name is 'Foo.named'. 82 * constructor for [:class Foo:] named 'named' the simple name is 'Foo.named'.
76 * For a property [:foo:] the simple name of the getter method is 'foo' and 83 * For a property [:foo:] the simple name of the getter method is 'foo' and
77 * the simple name of the setter is 'foo='. For operators the simple name is 84 * the simple name of the setter is 'foo='. For operators the simple name is
78 * the operator itself, for example '+' for [:operator +:]. 85 * the operator itself, for example '+' for [:operator +:].
(...skipping 10 matching lines...) Expand all
89 */ 96 */
90 String get displayName; 97 String get displayName;
91 98
92 /** 99 /**
93 * Returns the name of this entity qualified by is enclosing context. For 100 * Returns the name of this entity qualified by is enclosing context. For
94 * instance, the qualified name of a method 'method' in class 'Class' in 101 * instance, the qualified name of a method 'method' in class 'Class' in
95 * library 'library' is 'library.Class.method'. 102 * library 'library' is 'library.Class.method'.
96 */ 103 */
97 String get qualifiedName; 104 String get qualifiedName;
98 105
99 /**
100 * Returns the mirror system which contains this mirror.
101 */
102 MirrorSystem get system;
103 } 106 }
104 107
105 /** 108 /**
106 * Common interface for interface types and libraries. 109 * Common interface for interface types and libraries.
107 */ 110 */
108 abstract class ObjectMirror implements Mirror { 111 abstract class ObjectMirror implements Mirror {
109 112
110 /** 113 /**
111 * Returns an unmodifiable map of the members of declared in this type or 114 * Returns an unmodifiable map of the members of declared in this type or
112 * library. 115 * library.
113 */ 116 */
114 Map<String, MemberMirror> get declaredMembers; 117 Map<String, MemberMirror> get declaredMembers;
115 } 118 }
116 119
117 /** 120 /**
118 * A library. 121 * A library.
119 */ 122 */
120 abstract class LibraryMirror extends ObjectMirror { 123 abstract class LibraryMirror implements ObjectMirror, DeclarationMirror {
121 /** 124 /**
122 * The name of the library, as given in #library(). 125 * The name of the library, as given in #library().
123 */ 126 */
124 String get simpleName; 127 String get simpleName;
125 128
126 /** 129 /**
127 * Returns an iterable over all types in the library. 130 * Returns an iterable over all types in the library.
128 */ 131 */
129 Map<String, ClassMirror> get types; 132 Map<String, ClassMirror> get types;
130 133
131 /** 134 /**
132 * Returns the source location for this library. 135 * Returns the source location for this library.
133 */ 136 */
134 Location get location; 137 Location get location;
135 138
136 /** 139 /**
137 * Returns the canonical URI for this library. 140 * Returns the canonical URI for this library.
138 */ 141 */
139 Uri get uri; 142 Uri get uri;
140 } 143 }
141 144
142 /** 145 /**
143 * Common interface for classes, interfaces, typedefs and type variables. 146 * Common interface for classes, interfaces, typedefs and type variables.
144 */ 147 */
145 abstract class TypeMirror implements Mirror { 148 abstract class TypeMirror implements DeclarationMirror {
146 /** 149 /**
147 * Returns the source location for this type. 150 * Returns the source location for this type.
148 */ 151 */
149 Location get location; 152 Location get location;
150 153
151 /** 154 /**
152 * Returns the library in which this member resides. 155 * Returns the library in which this member resides.
153 */ 156 */
154 LibraryMirror get library; 157 LibraryMirror get library;
155 158
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 /** 299 /**
297 * Returns the defining type for this typedef. For instance [:void f(int):] 300 * Returns the defining type for this typedef. For instance [:void f(int):]
298 * for a [:typedef void f(int):]. 301 * for a [:typedef void f(int):].
299 */ 302 */
300 TypeMirror get definition; 303 TypeMirror get definition;
301 } 304 }
302 305
303 /** 306 /**
304 * A member of a type, i.e. a field, method or constructor. 307 * A member of a type, i.e. a field, method or constructor.
305 */ 308 */
306 abstract class MemberMirror implements Mirror { 309 abstract class MemberMirror implements DeclarationMirror {
307 /** 310 /**
308 * Returns the source location for this member. 311 * Returns the source location for this member.
309 */ 312 */
310 Location get location; 313 Location get location;
311 314
312 /** 315 /**
313 * Returns a mirror on the declaration immediately surrounding the reflectee. 316 * Returns a mirror on the declaration immediately surrounding the reflectee.
314 * This could be a class, interface, library or another method or function. 317 * This could be a class, interface, library or another method or function.
315 */ 318 */
316 ObjectMirror get surroundingDeclaration; 319 ObjectMirror get surroundingDeclaration;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 /** 503 /**
501 * Returns the URI where the source originated. 504 * Returns the URI where the source originated.
502 */ 505 */
503 Uri get uri; 506 Uri get uri;
504 507
505 /** 508 /**
506 * Returns the text of this source. 509 * Returns the text of this source.
507 */ 510 */
508 String get text; 511 String get text;
509 } 512 }
OLDNEW
« no previous file with comments | « no previous file | pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart » ('j') | pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698