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

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/source.dart

Issue 17932005: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Disable resolver tests Created 7 years, 6 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 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.source; 3 library engine.source;
4 import 'java_core.dart'; 4 import 'java_core.dart';
5 import 'sdk.dart' show DartSdk; 5 import 'sdk.dart' show DartSdk;
6 import 'engine.dart' show AnalysisContext; 6 import 'engine.dart' show AnalysisContext;
7 /** 7 /**
8 * Instances of the class `SourceFactory` resolve possibly relative URI's agains t an existing[Source source]. 8 * Instances of the class `SourceFactory` resolve possibly relative URI's agains t an existing
9 * [Source].
10 *
9 * @coverage dart.engine.source 11 * @coverage dart.engine.source
10 */ 12 */
11 class SourceFactory { 13 class SourceFactory {
12 14
13 /** 15 /**
14 * The analysis context that this source factory is associated with. 16 * The analysis context that this source factory is associated with.
15 */ 17 */
16 AnalysisContext _context; 18 AnalysisContext _context;
17 19
18 /** 20 /**
19 * The resolvers used to resolve absolute URI's. 21 * The resolvers used to resolve absolute URI's.
20 */ 22 */
21 List<UriResolver> _resolvers; 23 List<UriResolver> _resolvers;
22 24
23 /** 25 /**
24 * A cache of content used to override the default content of a source. 26 * A cache of content used to override the default content of a source.
25 */ 27 */
26 ContentCache _contentCache; 28 ContentCache _contentCache;
27 29
28 /** 30 /**
29 * Initialize a newly created source factory. 31 * Initialize a newly created source factory.
32 *
30 * @param contentCache the cache holding content used to override the default content of a source 33 * @param contentCache the cache holding content used to override the default content of a source
31 * @param resolvers the resolvers used to resolve absolute URI's 34 * @param resolvers the resolvers used to resolve absolute URI's
32 */ 35 */
33 SourceFactory.con1(ContentCache contentCache2, List<UriResolver> resolvers2) { 36 SourceFactory.con1(ContentCache contentCache2, List<UriResolver> resolvers2) {
34 _jtd_constructor_342_impl(contentCache2, resolvers2); 37 _jtd_constructor_342_impl(contentCache2, resolvers2);
35 } 38 }
36 _jtd_constructor_342_impl(ContentCache contentCache2, List<UriResolver> resolv ers2) { 39 _jtd_constructor_342_impl(ContentCache contentCache2, List<UriResolver> resolv ers2) {
37 this._contentCache = contentCache2; 40 this._contentCache = contentCache2;
38 this._resolvers = resolvers2; 41 this._resolvers = resolvers2;
39 } 42 }
40 43
41 /** 44 /**
42 * Initialize a newly created source factory. 45 * Initialize a newly created source factory.
46 *
43 * @param resolvers the resolvers used to resolve absolute URI's 47 * @param resolvers the resolvers used to resolve absolute URI's
44 */ 48 */
45 SourceFactory.con2(List<UriResolver> resolvers) { 49 SourceFactory.con2(List<UriResolver> resolvers) {
46 _jtd_constructor_343_impl(resolvers); 50 _jtd_constructor_343_impl(resolvers);
47 } 51 }
48 _jtd_constructor_343_impl(List<UriResolver> resolvers) { 52 _jtd_constructor_343_impl(List<UriResolver> resolvers) {
49 _jtd_constructor_342_impl(new ContentCache(), resolvers); 53 _jtd_constructor_342_impl(new ContentCache(), resolvers);
50 } 54 }
51 55
52 /** 56 /**
53 * Return a source object representing the given absolute URI, or `null` if th e URI is not a 57 * Return a source object representing the given absolute URI, or `null` if th e URI is not a
54 * valid URI or if it is not an absolute URI. 58 * valid URI or if it is not an absolute URI.
59 *
55 * @param absoluteUri the absolute URI to be resolved 60 * @param absoluteUri the absolute URI to be resolved
56 * @return a source object representing the absolute URI 61 * @return a source object representing the absolute URI
57 */ 62 */
58 Source forUri(String absoluteUri) { 63 Source forUri(String absoluteUri) {
59 try { 64 try {
60 Uri uri = parseUriWithException(absoluteUri); 65 Uri uri = parseUriWithException(absoluteUri);
61 if (uri.isAbsolute) { 66 if (uri.isAbsolute) {
62 return resolveUri2(null, uri); 67 return resolveUri2(null, uri);
63 } 68 }
64 } on URISyntaxException catch (exception) { 69 } on URISyntaxException catch (exception) {
65 } 70 }
66 return null; 71 return null;
67 } 72 }
68 73
69 /** 74 /**
70 * Return a source object that is equal to the source object used to obtain th e given encoding. 75 * Return a source object that is equal to the source object used to obtain th e given encoding.
76 *
71 * @param encoding the encoding of a source object 77 * @param encoding the encoding of a source object
72 * @return a source object that is described by the given encoding 78 * @return a source object that is described by the given encoding
73 * @throws IllegalArgumentException if the argument is not a valid encoding 79 * @throws IllegalArgumentException if the argument is not a valid encoding
74 * @see Source#getEncoding() 80 * @see Source#getEncoding()
75 */ 81 */
76 Source fromEncoding(String encoding) { 82 Source fromEncoding(String encoding) {
77 if (encoding.length < 2) { 83 if (encoding.length < 2) {
78 throw new IllegalArgumentException("Invalid encoding length"); 84 throw new IllegalArgumentException("Invalid encoding length");
79 } 85 }
80 UriKind kind = UriKind.fromEncoding(encoding.codeUnitAt(0)); 86 UriKind kind = UriKind.fromEncoding(encoding.codeUnitAt(0));
81 if (kind == null) { 87 if (kind == null) {
82 throw new IllegalArgumentException("Invalid source kind in encoding: ${kin d}"); 88 throw new IllegalArgumentException("Invalid source kind in encoding: ${kin d}");
83 } 89 }
84 try { 90 try {
85 Uri uri = parseUriWithException(encoding.substring(1)); 91 Uri uri = parseUriWithException(encoding.substring(1));
86 for (UriResolver resolver in _resolvers) { 92 for (UriResolver resolver in _resolvers) {
87 Source result = resolver.fromEncoding(_contentCache, kind, uri); 93 Source result = resolver.fromEncoding(_contentCache, kind, uri);
88 if (result != null) { 94 if (result != null) {
89 return result; 95 return result;
90 } 96 }
91 } 97 }
92 throw new IllegalArgumentException("No resolver for kind: ${kind}"); 98 throw new IllegalArgumentException("No resolver for kind: ${kind}");
93 } catch (exception) { 99 } catch (exception) {
94 throw new IllegalArgumentException("Invalid URI in encoding"); 100 throw new IllegalArgumentException("Invalid URI in encoding");
95 } 101 }
96 } 102 }
97 103
98 /** 104 /**
99 * Return a cache of content used to override the default content of a source. 105 * Return a cache of content used to override the default content of a source.
106 *
100 * @return a cache of content used to override the default content of a source 107 * @return a cache of content used to override the default content of a source
101 */ 108 */
102 ContentCache get contentCache => _contentCache; 109 ContentCache get contentCache => _contentCache;
103 110
104 /** 111 /**
105 * Return the analysis context that this source factory is associated with. 112 * Return the analysis context that this source factory is associated with.
113 *
106 * @return the analysis context that this source factory is associated with 114 * @return the analysis context that this source factory is associated with
107 */ 115 */
108 AnalysisContext get context => _context; 116 AnalysisContext get context => _context;
109 117
110 /** 118 /**
111 * Return the [DartSdk] associated with this [SourceFactory], or `null` if the re 119 * Return the [DartSdk] associated with this [SourceFactory], or `null` if the re
112 * is no such SDK. 120 * is no such SDK.
121 *
113 * @return the [DartSdk] associated with this [SourceFactory], or `null` if 122 * @return the [DartSdk] associated with this [SourceFactory], or `null` if
114 * there is no such SDK 123 * there is no such SDK
115 */ 124 */
116 DartSdk get dartSdk { 125 DartSdk get dartSdk {
117 for (UriResolver resolver in _resolvers) { 126 for (UriResolver resolver in _resolvers) {
118 if (resolver is DartUriResolver) { 127 if (resolver is DartUriResolver) {
119 DartUriResolver dartUriResolver = resolver as DartUriResolver; 128 DartUriResolver dartUriResolver = resolver as DartUriResolver;
120 return dartUriResolver.dartSdk; 129 return dartUriResolver.dartSdk;
121 } 130 }
122 } 131 }
123 return null; 132 return null;
124 } 133 }
125 134
126 /** 135 /**
127 * Return a source object representing the URI that results from resolving the given (possibly 136 * Return a source object representing the URI that results from resolving the given (possibly
128 * relative) contained URI against the URI associated with an existing source object, or`null` if either the contained URI is invalid or if it cannot be resol ved against the 137 * relative) contained URI against the URI associated with an existing source object, or
138 * `null` if either the contained URI is invalid or if it cannot be resolved a gainst the
129 * source object's URI. 139 * source object's URI.
140 *
130 * @param containingSource the source containing the given URI 141 * @param containingSource the source containing the given URI
131 * @param containedUri the (possibly relative) URI to be resolved against the containing source 142 * @param containedUri the (possibly relative) URI to be resolved against the containing source
132 * @return the source representing the contained URI 143 * @return the source representing the contained URI
133 */ 144 */
134 Source resolveUri(Source containingSource, String containedUri) { 145 Source resolveUri(Source containingSource, String containedUri) {
135 try { 146 try {
136 return resolveUri2(containingSource, parseUriWithException(containedUri)); 147 return resolveUri2(containingSource, parseUriWithException(containedUri));
137 } on URISyntaxException catch (exception) { 148 } on URISyntaxException catch (exception) {
138 return null; 149 return null;
139 } 150 }
140 } 151 }
141 152
142 /** 153 /**
143 * Return an absolute URI that represents the given source. 154 * Return an absolute URI that represents the given source.
155 *
144 * @param source the source to get URI for 156 * @param source the source to get URI for
145 * @return the absolute URI representing the given source, may be `null` 157 * @return the absolute URI representing the given source, may be `null`
146 */ 158 */
147 Uri restoreUri(Source source) { 159 Uri restoreUri(Source source) {
148 for (UriResolver resolver in _resolvers) { 160 for (UriResolver resolver in _resolvers) {
149 Uri uri = resolver.restoreAbsolute(source); 161 Uri uri = resolver.restoreAbsolute(source);
150 if (uri != null) { 162 if (uri != null) {
151 return uri; 163 return uri;
152 } 164 }
153 } 165 }
154 return null; 166 return null;
155 } 167 }
156 168
157 /** 169 /**
158 * Set the contents of the given source to the given contents. This has the ef fect of overriding 170 * Set the contents of the given source to the given contents. This has the ef fect of overriding
159 * the default contents of the source. If the contents are `null` the override is removed so 171 * the default contents of the source. If the contents are `null` the override is removed so
160 * that the default contents will be returned. 172 * that the default contents will be returned.
173 *
161 * @param source the source whose contents are being overridden 174 * @param source the source whose contents are being overridden
162 * @param contents the new contents of the source 175 * @param contents the new contents of the source
163 */ 176 */
164 void setContents(Source source, String contents) { 177 void setContents(Source source, String contents) {
165 _contentCache.setContents(source, contents); 178 _contentCache.setContents(source, contents);
166 } 179 }
167 180
168 /** 181 /**
169 * Set the analysis context that this source factory is associated with to the given context. 182 * Set the analysis context that this source factory is associated with to the given context.
170 * 183 *
171 * <b>Note:</b> This method should only be invoked by[AnalysisContextImpl#setS ourceFactory] and is only public out of 184 * <b>Note:</b> This method should only be invoked by
185 * [AnalysisContextImpl#setSourceFactory] and is only public out of
172 * necessity. 186 * necessity.
187 *
173 * @param context the analysis context that this source factory is associated with 188 * @param context the analysis context that this source factory is associated with
174 */ 189 */
175 void set context(AnalysisContext context2) { 190 void set context(AnalysisContext context2) {
176 this._context = context2; 191 this._context = context2;
177 } 192 }
178 193
179 /** 194 /**
180 * Return the contents of the given source, or `null` if this factory does not override the 195 * Return the contents of the given source, or `null` if this factory does not override the
181 * contents of the source. 196 * contents of the source.
182 * 197 *
183 * <b>Note:</b> This method is not intended to be used except by[FileBasedSour ce#getContents]. 198 * <b>Note:</b> This method is not intended to be used except by
199 * [FileBasedSource#getContents].
200 *
184 * @param source the source whose content is to be returned 201 * @param source the source whose content is to be returned
185 * @return the contents of the given source 202 * @return the contents of the given source
186 */ 203 */
187 String getContents(Source source) => _contentCache.getContents(source); 204 String getContents(Source source) => _contentCache.getContents(source);
188 205
189 /** 206 /**
190 * Return the modification stamp of the given source, or `null` if this factor y does not 207 * Return the modification stamp of the given source, or `null` if this factor y does not
191 * override the contents of the source. 208 * override the contents of the source.
192 * 209 *
193 * <b>Note:</b> This method is not intended to be used except by[FileBasedSour ce#getModificationStamp]. 210 * <b>Note:</b> This method is not intended to be used except by
211 * [FileBasedSource#getModificationStamp].
212 *
194 * @param source the source whose modification stamp is to be returned 213 * @param source the source whose modification stamp is to be returned
195 * @return the modification stamp of the given source 214 * @return the modification stamp of the given source
196 */ 215 */
197 int getModificationStamp(Source source) => _contentCache.getModificationStamp( source); 216 int getModificationStamp(Source source) => _contentCache.getModificationStamp( source);
198 217
199 /** 218 /**
200 * Return a source object representing the URI that results from resolving the given (possibly 219 * Return a source object representing the URI that results from resolving the given (possibly
201 * relative) contained URI against the URI associated with an existing source object, or`null` if either the contained URI is invalid or if it cannot be resol ved against the 220 * relative) contained URI against the URI associated with an existing source object, or
221 * `null` if either the contained URI is invalid or if it cannot be resolved a gainst the
202 * source object's URI. 222 * source object's URI.
223 *
203 * @param containingSource the source containing the given URI 224 * @param containingSource the source containing the given URI
204 * @param containedUri the (possibly relative) URI to be resolved against the containing source 225 * @param containedUri the (possibly relative) URI to be resolved against the containing source
205 * @return the source representing the contained URI 226 * @return the source representing the contained URI
206 */ 227 */
207 Source resolveUri2(Source containingSource, Uri containedUri) { 228 Source resolveUri2(Source containingSource, Uri containedUri) {
208 if (containedUri.isAbsolute) { 229 if (containedUri.isAbsolute) {
209 for (UriResolver resolver in _resolvers) { 230 for (UriResolver resolver in _resolvers) {
210 Source result = resolver.resolveAbsolute(_contentCache, containedUri); 231 Source result = resolver.resolveAbsolute(_contentCache, containedUri);
211 if (result != null) { 232 if (result != null) {
212 return result; 233 return result;
213 } 234 }
214 } 235 }
215 return null; 236 return null;
216 } else { 237 } else {
217 return containingSource.resolveRelative(containedUri); 238 return containingSource.resolveRelative(containedUri);
218 } 239 }
219 } 240 }
220 } 241 }
221 /** 242 /**
222 * The abstract class `UriResolver` defines the behavior of objects that are use d to resolve 243 * The abstract class `UriResolver` defines the behavior of objects that are use d to resolve
223 * URI's for a source factory. Subclasses of this class are expected to resolve a single scheme of 244 * URI's for a source factory. Subclasses of this class are expected to resolve a single scheme of
224 * absolute URI. 245 * absolute URI.
246 *
225 * @coverage dart.engine.source 247 * @coverage dart.engine.source
226 */ 248 */
227 abstract class UriResolver { 249 abstract class UriResolver {
228 250
229 /** 251 /**
230 * If this resolver should be used for URI's of the given kind, resolve the gi ven absolute URI. 252 * If this resolver should be used for URI's of the given kind, resolve the gi ven absolute URI.
231 * The URI does not need to have the scheme handled by this resolver if the ki nd matches. Return a[Source source] representing the file to which it was resolv ed, or `null` if it 253 * The URI does not need to have the scheme handled by this resolver if the ki nd matches. Return a
254 * [Source] representing the file to which it was resolved, or `null` if it
232 * could not be resolved. 255 * could not be resolved.
256 *
233 * @param contentCache the content cache used to access the contents of the re turned source 257 * @param contentCache the content cache used to access the contents of the re turned source
234 * @param kind the kind of URI that was originally resolved in order to produc e an encoding with 258 * @param kind the kind of URI that was originally resolved in order to produc e an encoding with
235 * the given URI 259 * the given URI
236 * @param uri the URI to be resolved 260 * @param uri the URI to be resolved
237 * @return a [Source source] representing the file to which given URI was reso lved 261 * @return a [Source] representing the file to which given URI was resolved
238 */ 262 */
239 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri); 263 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri);
240 264
241 /** 265 /**
242 * Resolve the given absolute URI. Return a [Source source] representing the f ile to which 266 * Resolve the given absolute URI. Return a [Source] representing the file to which
243 * it was resolved, or `null` if it could not be resolved. 267 * it was resolved, or `null` if it could not be resolved.
268 *
244 * @param contentCache the content cache used to access the contents of the re turned source 269 * @param contentCache the content cache used to access the contents of the re turned source
245 * @param uri the URI to be resolved 270 * @param uri the URI to be resolved
246 * @return a [Source source] representing the file to which given URI was reso lved 271 * @return a [Source] representing the file to which given URI was resolved
247 */ 272 */
248 Source resolveAbsolute(ContentCache contentCache, Uri uri); 273 Source resolveAbsolute(ContentCache contentCache, Uri uri);
249 274
250 /** 275 /**
251 * Return an absolute URI that represents the given source. 276 * Return an absolute URI that represents the given source.
277 *
252 * @param source the source to get URI for 278 * @param source the source to get URI for
253 * @return the absolute URI representing the given source, may be `null` 279 * @return the absolute URI representing the given source, may be `null`
254 */ 280 */
255 Uri restoreAbsolute(Source source) => null; 281 Uri restoreAbsolute(Source source) => null;
256 } 282 }
257 /** 283 /**
258 * The interface `Source` defines the behavior of objects representing source co de that can be 284 * The interface `Source` defines the behavior of objects representing source co de that can be
259 * compiled. 285 * compiled.
286 *
260 * @coverage dart.engine.source 287 * @coverage dart.engine.source
261 */ 288 */
262 abstract class Source { 289 abstract class Source {
263 290
264 /** 291 /**
265 * An empty array of sources. 292 * An empty array of sources.
266 */ 293 */
267 static final List<Source> EMPTY_ARRAY = new List<Source>(0); 294 static final List<Source> EMPTY_ARRAY = new List<Source>(0);
268 295
269 /** 296 /**
270 * Return `true` if the given object is a source that represents the same sour ce code as 297 * Return `true` if the given object is a source that represents the same sour ce code as
271 * this source. 298 * this source.
299 *
272 * @param object the object to be compared with this object 300 * @param object the object to be compared with this object
273 * @return `true` if the given object is a source that represents the same sou rce code as 301 * @return `true` if the given object is a source that represents the same sou rce code as
274 * this source 302 * this source
275 * @see Object#equals(Object) 303 * @see Object#equals(Object)
276 */ 304 */
277 bool operator ==(Object object); 305 bool operator ==(Object object);
278 306
279 /** 307 /**
280 * Return `true` if this source exists. 308 * Return `true` if this source exists.
309 *
281 * @return `true` if this source exists 310 * @return `true` if this source exists
282 */ 311 */
283 bool exists(); 312 bool exists();
284 313
285 /** 314 /**
286 * Get the contents of this source and pass it to the given receiver. Exactly one of the methods 315 * Get the contents of this source and pass it to the given receiver. Exactly one of the methods
287 * defined on the receiver will be invoked unless an exception is thrown. The method that will be 316 * defined on the receiver will be invoked unless an exception is thrown. The method that will be
288 * invoked depends on which of the possible representations of the contents is the most efficient. 317 * invoked depends on which of the possible representations of the contents is the most efficient.
289 * Whichever method is invoked, it will be invoked before this method returns. 318 * Whichever method is invoked, it will be invoked before this method returns.
319 *
290 * @param receiver the content receiver to which the content of this source wi ll be passed 320 * @param receiver the content receiver to which the content of this source wi ll be passed
291 * @throws Exception if the contents of this source could not be accessed 321 * @throws Exception if the contents of this source could not be accessed
292 */ 322 */
293 void getContents(Source_ContentReceiver receiver); 323 void getContents(Source_ContentReceiver receiver);
294 324
295 /** 325 /**
296 * Return an encoded representation of this source that can be used to create a source that is 326 * Return an encoded representation of this source that can be used to create a source that is
297 * equal to this source. 327 * equal to this source.
328 *
298 * @return an encoded representation of this source 329 * @return an encoded representation of this source
299 * @see SourceFactory#fromEncoding(String) 330 * @see SourceFactory#fromEncoding(String)
300 */ 331 */
301 String get encoding; 332 String get encoding;
302 333
303 /** 334 /**
304 * Return the full (long) version of the name that can be displayed to the use r to denote this 335 * Return the full (long) version of the name that can be displayed to the use r to denote this
305 * source. For example, for a source representing a file this would typically be the absolute path 336 * source. For example, for a source representing a file this would typically be the absolute path
306 * of the file. 337 * of the file.
338 *
307 * @return a name that can be displayed to the user to denote this source 339 * @return a name that can be displayed to the user to denote this source
308 */ 340 */
309 String get fullName; 341 String get fullName;
310 342
311 /** 343 /**
312 * Return the modification stamp for this source. A modification stamp is a no n-negative integer 344 * Return the modification stamp for this source. A modification stamp is a no n-negative integer
313 * with the property that if the contents of the source have not been modified since the last time 345 * with the property that if the contents of the source have not been modified since the last time
314 * the modification stamp was accessed then the same value will be returned, b ut if the contents 346 * the modification stamp was accessed then the same value will be returned, b ut if the contents
315 * of the source have been modified one or more times (even if the net change is zero) the stamps 347 * of the source have been modified one or more times (even if the net change is zero) the stamps
316 * will be different. 348 * will be different.
349 *
317 * @return the modification stamp for this source 350 * @return the modification stamp for this source
318 */ 351 */
319 int get modificationStamp; 352 int get modificationStamp;
320 353
321 /** 354 /**
322 * Return a short version of the name that can be displayed to the user to den ote this source. For 355 * Return a short version of the name that can be displayed to the user to den ote this source. For
323 * example, for a source representing a file this would typically be the name of the file. 356 * example, for a source representing a file this would typically be the name of the file.
357 *
324 * @return a name that can be displayed to the user to denote this source 358 * @return a name that can be displayed to the user to denote this source
325 */ 359 */
326 String get shortName; 360 String get shortName;
327 361
328 /** 362 /**
329 * Return the kind of URI from which this source was originally derived. If th is source was 363 * Return the kind of URI from which this source was originally derived. If th is source was
330 * created from an absolute URI, then the returned kind will reflect the schem e of the absolute 364 * created from an absolute URI, then the returned kind will reflect the schem e of the absolute
331 * URI. If it was created from a relative URI, then the returned kind will be the same as the kind 365 * URI. If it was created from a relative URI, then the returned kind will be the same as the kind
332 * of the source against which the relative URI was resolved. 366 * of the source against which the relative URI was resolved.
367 *
333 * @return the kind of URI from which this source was originally derived 368 * @return the kind of URI from which this source was originally derived
334 */ 369 */
335 UriKind get uriKind; 370 UriKind get uriKind;
336 371
337 /** 372 /**
338 * Return a hash code for this source. 373 * Return a hash code for this source.
374 *
339 * @return a hash code for this source 375 * @return a hash code for this source
340 * @see Object#hashCode() 376 * @see Object#hashCode()
341 */ 377 */
342 int get hashCode; 378 int get hashCode;
343 379
344 /** 380 /**
345 * Return `true` if this source is in one of the system libraries. 381 * Return `true` if this source is in one of the system libraries.
382 *
346 * @return `true` if this is in a system library 383 * @return `true` if this is in a system library
347 */ 384 */
348 bool get isInSystemLibrary; 385 bool get isInSystemLibrary;
349 386
350 /** 387 /**
351 * Resolve the relative URI against the URI associated with this source object . Return a[Source source] representing the URI to which it was resolved, or `nul l` if it 388 * Resolve the relative URI against the URI associated with this source object . Return a
389 * [Source] representing the URI to which it was resolved, or `null` if it
352 * could not be resolved. 390 * could not be resolved.
353 * 391 *
354 * Note: This method is not intended for public use, it is only visible out of necessity. It is 392 * Note: This method is not intended for public use, it is only visible out of necessity. It is
355 * only intended to be invoked by a [SourceFactory source factory]. Source fac tories will 393 * only intended to be invoked by a [SourceFactory]. Source factories will
356 * only invoke this method if the URI is relative, so implementations of this method are not 394 * only invoke this method if the URI is relative, so implementations of this method are not
357 * required to, and generally do not, verify the argument. The result of invok ing this method with 395 * required to, and generally do not, verify the argument. The result of invok ing this method with
358 * an absolute URI is intentionally left unspecified. 396 * an absolute URI is intentionally left unspecified.
397 *
359 * @param relativeUri the relative URI to be resolved against the containing s ource 398 * @param relativeUri the relative URI to be resolved against the containing s ource
360 * @return a [Source source] representing the URI to which given URI was resol ved 399 * @return a [Source] representing the URI to which given URI was resolved
361 */ 400 */
362 Source resolveRelative(Uri relativeUri); 401 Source resolveRelative(Uri relativeUri);
363 } 402 }
364 /** 403 /**
365 * The interface `ContentReceiver` defines the behavior of objects that can rece ive the 404 * The interface `ContentReceiver` defines the behavior of objects that can rece ive the
366 * content of a source. 405 * content of a source.
367 */ 406 */
368 abstract class Source_ContentReceiver { 407 abstract class Source_ContentReceiver {
369 408
370 /** 409 /**
371 * Accept the contents of a source represented as a character buffer. 410 * Accept the contents of a source represented as a character buffer.
411 *
372 * @param contents the contents of the source 412 * @param contents the contents of the source
373 * @param modificationTime the time at which the contents were last set 413 * @param modificationTime the time at which the contents were last set
374 */ 414 */
375 void accept(CharBuffer contents, int modificationTime); 415 void accept(CharBuffer contents, int modificationTime);
376 416
377 /** 417 /**
378 * Accept the contents of a source represented as a string. 418 * Accept the contents of a source represented as a string.
419 *
379 * @param contents the contents of the source 420 * @param contents the contents of the source
380 * @param modificationTime the time at which the contents were last set 421 * @param modificationTime the time at which the contents were last set
381 */ 422 */
382 void accept2(String contents, int modificationTime); 423 void accept2(String contents, int modificationTime);
383 } 424 }
384 /** 425 /**
385 * The enumeration `SourceKind` defines the different kinds of sources that are known to the 426 * The enumeration `SourceKind` defines the different kinds of sources that are known to the
386 * analysis engine. 427 * analysis engine.
428 *
387 * @coverage dart.engine.source 429 * @coverage dart.engine.source
388 */ 430 */
389 class SourceKind implements Comparable<SourceKind> { 431 class SourceKind implements Comparable<SourceKind> {
390 432
391 /** 433 /**
392 * A source containing HTML. The HTML might or might not contain Dart scripts. 434 * A source containing HTML. The HTML might or might not contain Dart scripts.
393 */ 435 */
394 static final SourceKind HTML = new SourceKind('HTML', 0); 436 static final SourceKind HTML = new SourceKind('HTML', 0);
395 437
396 /** 438 /**
(...skipping 22 matching lines...) Expand all
419 final int ordinal; 461 final int ordinal;
420 SourceKind(this.name, this.ordinal) { 462 SourceKind(this.name, this.ordinal) {
421 } 463 }
422 int compareTo(SourceKind other) => ordinal - other.ordinal; 464 int compareTo(SourceKind other) => ordinal - other.ordinal;
423 int get hashCode => ordinal; 465 int get hashCode => ordinal;
424 String toString() => name; 466 String toString() => name;
425 } 467 }
426 /** 468 /**
427 * The enumeration `UriKind` defines the different kinds of URI's that are known to the 469 * The enumeration `UriKind` defines the different kinds of URI's that are known to the
428 * analysis engine. These are used to keep track of the kind of URI associated w ith a given source. 470 * analysis engine. These are used to keep track of the kind of URI associated w ith a given source.
471 *
429 * @coverage dart.engine.source 472 * @coverage dart.engine.source
430 */ 473 */
431 class UriKind implements Comparable<UriKind> { 474 class UriKind implements Comparable<UriKind> {
432 475
433 /** 476 /**
434 * A 'dart:' URI. 477 * A 'dart:' URI.
435 */ 478 */
436 static final UriKind DART_URI = new UriKind('DART_URI', 0, 0x64); 479 static final UriKind DART_URI = new UriKind('DART_URI', 0, 0x64);
437 480
438 /** 481 /**
(...skipping 13 matching lines...) Expand all
452 /// The position in the enum declaration. 495 /// The position in the enum declaration.
453 final int ordinal; 496 final int ordinal;
454 497
455 /** 498 /**
456 * The single character encoding used to identify this kind of URI. 499 * The single character encoding used to identify this kind of URI.
457 */ 500 */
458 int _encoding = 0; 501 int _encoding = 0;
459 502
460 /** 503 /**
461 * Initialize a newly created URI kind to have the given encoding. 504 * Initialize a newly created URI kind to have the given encoding.
505 *
462 * @param encoding the single character encoding used to identify this kind of URI. 506 * @param encoding the single character encoding used to identify this kind of URI.
463 */ 507 */
464 UriKind(this.name, this.ordinal, int encoding) { 508 UriKind(this.name, this.ordinal, int encoding) {
465 this._encoding = encoding; 509 this._encoding = encoding;
466 } 510 }
467 511
468 /** 512 /**
469 * Return the URI kind represented by the given encoding, or `null` if there i s no kind with 513 * Return the URI kind represented by the given encoding, or `null` if there i s no kind with
470 * the given encoding. 514 * the given encoding.
515 *
471 * @param encoding the single character encoding used to identify the URI kind to be returned 516 * @param encoding the single character encoding used to identify the URI kind to be returned
472 * @return the URI kind represented by the given encoding 517 * @return the URI kind represented by the given encoding
473 */ 518 */
474 static UriKind fromEncoding(int encoding) { 519 static UriKind fromEncoding(int encoding) {
475 while (true) { 520 while (true) {
476 if (encoding == 0x64) { 521 if (encoding == 0x64) {
477 return DART_URI; 522 return DART_URI;
478 } else if (encoding == 0x66) { 523 } else if (encoding == 0x66) {
479 return FILE_URI; 524 return FILE_URI;
480 } else if (encoding == 0x70) { 525 } else if (encoding == 0x70) {
481 return PACKAGE_URI; 526 return PACKAGE_URI;
482 } 527 }
483 break; 528 break;
484 } 529 }
485 return null; 530 return null;
486 } 531 }
487 532
488 /** 533 /**
489 * Return the single character encoding used to identify this kind of URI. 534 * Return the single character encoding used to identify this kind of URI.
535 *
490 * @return the single character encoding used to identify this kind of URI 536 * @return the single character encoding used to identify this kind of URI
491 */ 537 */
492 int get encoding => _encoding; 538 int get encoding => _encoding;
493 int compareTo(UriKind other) => ordinal - other.ordinal; 539 int compareTo(UriKind other) => ordinal - other.ordinal;
494 int get hashCode => ordinal; 540 int get hashCode => ordinal;
495 String toString() => name; 541 String toString() => name;
496 } 542 }
497 /** 543 /**
498 * A source range defines an [Element]'s source coordinates relative to its [Sou rce]. 544 * A source range defines an [Element]'s source coordinates relative to its [Sou rce].
545 *
499 * @coverage dart.engine.utilities 546 * @coverage dart.engine.utilities
500 */ 547 */
501 class SourceRange { 548 class SourceRange {
502 549
503 /** 550 /**
504 * The 0-based index of the first character of the source code for this elemen t, relative to the 551 * The 0-based index of the first character of the source code for this elemen t, relative to the
505 * source buffer in which this element is contained. 552 * source buffer in which this element is contained.
506 */ 553 */
507 int _offset = 0; 554 int _offset = 0;
508 555
509 /** 556 /**
510 * The number of characters of the source code for this element, relative to t he source buffer in 557 * The number of characters of the source code for this element, relative to t he source buffer in
511 * which this element is contained. 558 * which this element is contained.
512 */ 559 */
513 int _length = 0; 560 int _length = 0;
514 561
515 /** 562 /**
516 * Initialize a newly created source range using the given offset and the give n length. 563 * Initialize a newly created source range using the given offset and the give n length.
564 *
517 * @param offset the given offset 565 * @param offset the given offset
518 * @param length the given length 566 * @param length the given length
519 */ 567 */
520 SourceRange(int offset, int length) { 568 SourceRange(int offset, int length) {
521 this._offset = offset; 569 this._offset = offset;
522 this._length = length; 570 this._length = length;
523 } 571 }
524 572
525 /** 573 /**
526 * @return `true` if <code>x</code> is in \[offset, offset + length) interval. 574 * @return `true` if <code>x</code> is in [offset, offset + length) interval.
527 */ 575 */
528 bool contains(int x) => _offset <= x && x < _offset + _length; 576 bool contains(int x) => _offset <= x && x < _offset + _length;
529 577
530 /** 578 /**
531 * @return `true` if <code>x</code> is in (offset, offset + length) interval. 579 * @return `true` if <code>x</code> is in (offset, offset + length) interval.
532 */ 580 */
533 bool containsExclusive(int x) => _offset < x && x < _offset + _length; 581 bool containsExclusive(int x) => _offset < x && x < _offset + _length;
534 582
535 /** 583 /**
536 * @return `true` if <code>otherRange</code> covers this [SourceRange]. 584 * @return `true` if <code>otherRange</code> covers this [SourceRange].
(...skipping 15 matching lines...) Expand all
552 bool operator ==(Object obj) { 600 bool operator ==(Object obj) {
553 if (obj is! SourceRange) { 601 if (obj is! SourceRange) {
554 return false; 602 return false;
555 } 603 }
556 SourceRange sourceRange = obj as SourceRange; 604 SourceRange sourceRange = obj as SourceRange;
557 return sourceRange.offset == _offset && sourceRange.length == _length; 605 return sourceRange.offset == _offset && sourceRange.length == _length;
558 } 606 }
559 607
560 /** 608 /**
561 * @return the 0-based index of the after-last character of the source code fo r this element, 609 * @return the 0-based index of the after-last character of the source code fo r this element,
562 * relative to the source buffer in which this element is contained. 610 * relative to the source buffer in which this element is contained.
563 */ 611 */
564 int get end => _offset + _length; 612 int get end => _offset + _length;
565 613
566 /** 614 /**
567 * @return the expanded instance of [SourceRange], which has the same center. 615 * @return the expanded instance of [SourceRange], which has the same center.
568 */ 616 */
569 SourceRange getExpanded(int delta) => new SourceRange(_offset - delta, delta + _length + delta); 617 SourceRange getExpanded(int delta) => new SourceRange(_offset - delta, delta + _length + delta);
570 618
571 /** 619 /**
572 * Returns the number of characters of the source code for this element, relat ive to the source 620 * Returns the number of characters of the source code for this element, relat ive to the source
573 * buffer in which this element is contained. 621 * buffer in which this element is contained.
622 *
574 * @return the number of characters of the source code for this element, relat ive to the source 623 * @return the number of characters of the source code for this element, relat ive to the source
575 * buffer in which this element is contained 624 * buffer in which this element is contained
576 */ 625 */
577 int get length => _length; 626 int get length => _length;
578 627
579 /** 628 /**
580 * @return the instance of [SourceRange] with end moved on "delta". 629 * @return the instance of [SourceRange] with end moved on "delta".
581 */ 630 */
582 SourceRange getMoveEnd(int delta) => new SourceRange(_offset, _length + delta) ; 631 SourceRange getMoveEnd(int delta) => new SourceRange(_offset, _length + delta) ;
583 632
584 /** 633 /**
585 * Returns the 0-based index of the first character of the source code for thi s element, relative 634 * Returns the 0-based index of the first character of the source code for thi s element, relative
586 * to the source buffer in which this element is contained. 635 * to the source buffer in which this element is contained.
636 *
587 * @return the 0-based index of the first character of the source code for thi s element, relative 637 * @return the 0-based index of the first character of the source code for thi s element, relative
588 * to the source buffer in which this element is contained 638 * to the source buffer in which this element is contained
589 */ 639 */
590 int get offset => _offset; 640 int get offset => _offset;
591 641
592 /** 642 /**
593 * @return the expanded translated of [SourceRange], with moved start and the same length. 643 * @return the expanded translated of [SourceRange], with moved start and the same length.
594 */ 644 */
595 SourceRange getTranslated(int delta) => new SourceRange(_offset + delta, _leng th); 645 SourceRange getTranslated(int delta) => new SourceRange(_offset + delta, _leng th);
596 int get hashCode => 31 * _offset + _length; 646 int get hashCode => 31 * _offset + _length;
597 647
598 /** 648 /**
(...skipping 26 matching lines...) Expand all
625 return builder.toString(); 675 return builder.toString();
626 } 676 }
627 } 677 }
628 /** 678 /**
629 * The interface `SourceContainer` is used by clients to define a collection of sources 679 * The interface `SourceContainer` is used by clients to define a collection of sources
630 * 680 *
631 * Source containers are not used within analysis engine, but can be used by cli ents to group 681 * Source containers are not used within analysis engine, but can be used by cli ents to group
632 * sources for the purposes of accessing composite dependency information. For e xample, the Eclipse 682 * sources for the purposes of accessing composite dependency information. For e xample, the Eclipse
633 * client uses source containers to represent Eclipse projects, which allows it to easily compute 683 * client uses source containers to represent Eclipse projects, which allows it to easily compute
634 * project-level dependencies. 684 * project-level dependencies.
685 *
635 * @coverage dart.engine.source 686 * @coverage dart.engine.source
636 */ 687 */
637 abstract class SourceContainer { 688 abstract class SourceContainer {
638 689
639 /** 690 /**
640 * Determine if the specified source is part of the receiver's collection of s ources. 691 * Determine if the specified source is part of the receiver's collection of s ources.
692 *
641 * @param source the source in question 693 * @param source the source in question
642 * @return `true` if the receiver contains the source, else `false` 694 * @return `true` if the receiver contains the source, else `false`
643 */ 695 */
644 bool contains(Source source); 696 bool contains(Source source);
645 } 697 }
646 /** 698 /**
647 * Instances of the class `DartUriResolver` resolve `dart` URI's. 699 * Instances of the class `DartUriResolver` resolve `dart` URI's.
700 *
648 * @coverage dart.engine.source 701 * @coverage dart.engine.source
649 */ 702 */
650 class DartUriResolver extends UriResolver { 703 class DartUriResolver extends UriResolver {
651 704
652 /** 705 /**
653 * The Dart SDK against which URI's are to be resolved. 706 * The Dart SDK against which URI's are to be resolved.
654 */ 707 */
655 DartSdk _sdk; 708 DartSdk _sdk;
656 709
657 /** 710 /**
658 * The name of the `dart` scheme. 711 * The name of the `dart` scheme.
659 */ 712 */
660 static String _DART_SCHEME = "dart"; 713 static String _DART_SCHEME = "dart";
661 714
662 /** 715 /**
663 * Return `true` if the given URI is a `dart:` URI. 716 * Return `true` if the given URI is a `dart:` URI.
717 *
664 * @param uri the URI being tested 718 * @param uri the URI being tested
665 * @return `true` if the given URI is a `dart:` URI 719 * @return `true` if the given URI is a `dart:` URI
666 */ 720 */
667 static bool isDartUri(Uri uri) => _DART_SCHEME == uri.scheme; 721 static bool isDartUri(Uri uri) => _DART_SCHEME == uri.scheme;
668 722
669 /** 723 /**
670 * Initialize a newly created resolver to resolve Dart URI's against the given platform within the 724 * Initialize a newly created resolver to resolve Dart URI's against the given platform within the
671 * given Dart SDK. 725 * given Dart SDK.
726 *
672 * @param sdk the Dart SDK against which URI's are to be resolved 727 * @param sdk the Dart SDK against which URI's are to be resolved
673 */ 728 */
674 DartUriResolver(DartSdk sdk) { 729 DartUriResolver(DartSdk sdk) {
675 this._sdk = sdk; 730 this._sdk = sdk;
676 } 731 }
677 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) { 732 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) {
678 if (identical(kind, UriKind.DART_URI)) { 733 if (identical(kind, UriKind.DART_URI)) {
679 return _sdk.fromEncoding(contentCache, kind, uri); 734 return _sdk.fromEncoding(contentCache, kind, uri);
680 } 735 }
681 return null; 736 return null;
682 } 737 }
683 738
684 /** 739 /**
685 * Return the [DartSdk] against which URIs are to be resolved. 740 * Return the [DartSdk] against which URIs are to be resolved.
741 *
686 * @return the [DartSdk] against which URIs are to be resolved. 742 * @return the [DartSdk] against which URIs are to be resolved.
687 */ 743 */
688 DartSdk get dartSdk => _sdk; 744 DartSdk get dartSdk => _sdk;
689 Source resolveAbsolute(ContentCache contentCache, Uri uri) { 745 Source resolveAbsolute(ContentCache contentCache, Uri uri) {
690 if (!isDartUri(uri)) { 746 if (!isDartUri(uri)) {
691 return null; 747 return null;
692 } 748 }
693 return _sdk.mapDartUri(contentCache, uri.toString()); 749 return _sdk.mapDartUri(contentCache, uri.toString());
694 } 750 }
695 } 751 }
696 /** 752 /**
697 * Instances of the class `LineInfo` encapsulate information about line and colu mn information 753 * Instances of the class `LineInfo` encapsulate information about line and colu mn information
698 * within a source file. 754 * within a source file.
755 *
699 * @coverage dart.engine.utilities 756 * @coverage dart.engine.utilities
700 */ 757 */
701 class LineInfo { 758 class LineInfo {
702 759
703 /** 760 /**
704 * An array containing the offsets of the first character of each line in the source code. 761 * An array containing the offsets of the first character of each line in the source code.
705 */ 762 */
706 List<int> _lineStarts; 763 List<int> _lineStarts;
707 764
708 /** 765 /**
709 * Initialize a newly created set of line information to represent the data en coded in the given 766 * Initialize a newly created set of line information to represent the data en coded in the given
710 * array. 767 * array.
768 *
711 * @param lineStarts the offsets of the first character of each line in the so urce code 769 * @param lineStarts the offsets of the first character of each line in the so urce code
712 */ 770 */
713 LineInfo(List<int> lineStarts) { 771 LineInfo(List<int> lineStarts) {
714 if (lineStarts == null) { 772 if (lineStarts == null) {
715 throw new IllegalArgumentException("lineStarts must be non-null"); 773 throw new IllegalArgumentException("lineStarts must be non-null");
716 } else if (lineStarts.length < 1) { 774 } else if (lineStarts.length < 1) {
717 throw new IllegalArgumentException("lineStarts must be non-empty"); 775 throw new IllegalArgumentException("lineStarts must be non-empty");
718 } 776 }
719 this._lineStarts = lineStarts; 777 this._lineStarts = lineStarts;
720 } 778 }
721 779
722 /** 780 /**
723 * Return the location information for the character at the given offset. 781 * Return the location information for the character at the given offset.
782 *
724 * @param offset the offset of the character for which location information is to be returned 783 * @param offset the offset of the character for which location information is to be returned
725 * @return the location information for the character at the given offset 784 * @return the location information for the character at the given offset
726 */ 785 */
727 LineInfo_Location getLocation(int offset) { 786 LineInfo_Location getLocation(int offset) {
728 int lineCount = _lineStarts.length; 787 int lineCount = _lineStarts.length;
729 for (int i = 1; i < lineCount; i++) { 788 for (int i = 1; i < lineCount; i++) {
730 if (offset < _lineStarts[i]) { 789 if (offset < _lineStarts[i]) {
731 return new LineInfo_Location(i, offset - _lineStarts[i - 1] + 1); 790 return new LineInfo_Location(i, offset - _lineStarts[i - 1] + 1);
732 } 791 }
733 } 792 }
(...skipping 12 matching lines...) Expand all
746 int _lineNumber = 0; 805 int _lineNumber = 0;
747 806
748 /** 807 /**
749 * The one-based index of the column containing the character. 808 * The one-based index of the column containing the character.
750 */ 809 */
751 int _columnNumber = 0; 810 int _columnNumber = 0;
752 811
753 /** 812 /**
754 * Initialize a newly created location to represent the location of the charac ter at the given 813 * Initialize a newly created location to represent the location of the charac ter at the given
755 * line and column position. 814 * line and column position.
815 *
756 * @param lineNumber the one-based index of the line containing the character 816 * @param lineNumber the one-based index of the line containing the character
757 * @param columnNumber the one-based index of the column containing the charac ter 817 * @param columnNumber the one-based index of the column containing the charac ter
758 */ 818 */
759 LineInfo_Location(int lineNumber, int columnNumber) { 819 LineInfo_Location(int lineNumber, int columnNumber) {
760 this._lineNumber = lineNumber; 820 this._lineNumber = lineNumber;
761 this._columnNumber = columnNumber; 821 this._columnNumber = columnNumber;
762 } 822 }
763 823
764 /** 824 /**
765 * Return the one-based index of the column containing the character. 825 * Return the one-based index of the column containing the character.
826 *
766 * @return the one-based index of the column containing the character 827 * @return the one-based index of the column containing the character
767 */ 828 */
768 int get columnNumber => _columnNumber; 829 int get columnNumber => _columnNumber;
769 830
770 /** 831 /**
771 * Return the one-based index of the line containing the character. 832 * Return the one-based index of the line containing the character.
833 *
772 * @return the one-based index of the line containing the character 834 * @return the one-based index of the line containing the character
773 */ 835 */
774 int get lineNumber => _lineNumber; 836 int get lineNumber => _lineNumber;
775 } 837 }
776 /** 838 /**
777 * Instances of class `ContentCache` hold content used to override the default c ontent of a[Source]. 839 * Instances of class `ContentCache` hold content used to override the default c ontent of a
840 * [Source].
841 *
778 * @coverage dart.engine.source 842 * @coverage dart.engine.source
779 */ 843 */
780 class ContentCache { 844 class ContentCache {
781 845
782 /** 846 /**
783 * A table mapping sources to the contents of those sources. This is used to o verride the default 847 * A table mapping sources to the contents of those sources. This is used to o verride the default
784 * contents of a source. 848 * contents of a source.
785 */ 849 */
786 Map<Source, String> _contentMap = new Map<Source, String>(); 850 Map<Source, String> _contentMap = new Map<Source, String>();
787 851
788 /** 852 /**
789 * A table mapping sources to the modification stamps of those sources. This i s used when the 853 * A table mapping sources to the modification stamps of those sources. This i s used when the
790 * default contents of a source has been overridden. 854 * default contents of a source has been overridden.
791 */ 855 */
792 Map<Source, int> _stampMap = new Map<Source, int>(); 856 Map<Source, int> _stampMap = new Map<Source, int>();
793 857
794 /** 858 /**
795 * Return the contents of the given source, or `null` if this cache does not o verride the 859 * Return the contents of the given source, or `null` if this cache does not o verride the
796 * contents of the source. 860 * contents of the source.
797 * 861 *
798 * <b>Note:</b> This method is not intended to be used except by[SourceFactory #getContents]. 862 * <b>Note:</b> This method is not intended to be used except by
863 * [SourceFactory#getContents].
864 *
799 * @param source the source whose content is to be returned 865 * @param source the source whose content is to be returned
800 * @return the contents of the given source 866 * @return the contents of the given source
801 */ 867 */
802 String getContents(Source source) => _contentMap[source]; 868 String getContents(Source source) => _contentMap[source];
803 869
804 /** 870 /**
805 * Return the modification stamp of the given source, or `null` if this cache does not 871 * Return the modification stamp of the given source, or `null` if this cache does not
806 * override the contents of the source. 872 * override the contents of the source.
807 * 873 *
808 * <b>Note:</b> This method is not intended to be used except by[SourceFactory #getModificationStamp]. 874 * <b>Note:</b> This method is not intended to be used except by
875 * [SourceFactory#getModificationStamp].
876 *
809 * @param source the source whose modification stamp is to be returned 877 * @param source the source whose modification stamp is to be returned
810 * @return the modification stamp of the given source 878 * @return the modification stamp of the given source
811 */ 879 */
812 int getModificationStamp(Source source) => _stampMap[source]; 880 int getModificationStamp(Source source) => _stampMap[source];
813 881
814 /** 882 /**
815 * Set the contents of the given source to the given contents. This has the ef fect of overriding 883 * Set the contents of the given source to the given contents. This has the ef fect of overriding
816 * the default contents of the source. If the contents are `null` the override is removed so 884 * the default contents of the source. If the contents are `null` the override is removed so
817 * that the default contents will be returned. 885 * that the default contents will be returned.
886 *
818 * @param source the source whose contents are being overridden 887 * @param source the source whose contents are being overridden
819 * @param contents the new contents of the source 888 * @param contents the new contents of the source
820 */ 889 */
821 void setContents(Source source, String contents) { 890 void setContents(Source source, String contents) {
822 if (contents == null) { 891 if (contents == null) {
823 _contentMap.remove(source); 892 _contentMap.remove(source);
824 _stampMap.remove(source); 893 _stampMap.remove(source);
825 } else { 894 } else {
826 _contentMap[source] = contents; 895 _contentMap[source] = contents;
827 _stampMap[source] = JavaSystem.currentTimeMillis(); 896 _stampMap[source] = JavaSystem.currentTimeMillis();
828 } 897 }
829 } 898 }
830 } 899 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/sdk_io.dart ('k') | pkg/analyzer_experimental/lib/src/generated/source_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698