| OLD | NEW |
| 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 {@code SourceFactory} resolve possibly relative URI's
against an existing{@link Source source}. | 8 * Instances of the class `SourceFactory` resolve possibly relative URI's agains
t an existing[Source source]. |
| 9 * @coverage dart.engine.source | 9 * @coverage dart.engine.source |
| 10 */ | 10 */ |
| 11 class SourceFactory { | 11 class SourceFactory { |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * The analysis context that this source factory is associated with. | 14 * The analysis context that this source factory is associated with. |
| 15 */ | 15 */ |
| 16 AnalysisContext _context; | 16 AnalysisContext _context; |
| 17 | 17 |
| 18 /** | 18 /** |
| (...skipping 24 matching lines...) Expand all Loading... |
| 43 * @param resolvers the resolvers used to resolve absolute URI's | 43 * @param resolvers the resolvers used to resolve absolute URI's |
| 44 */ | 44 */ |
| 45 SourceFactory.con2(List<UriResolver> resolvers) { | 45 SourceFactory.con2(List<UriResolver> resolvers) { |
| 46 _jtd_constructor_343_impl(resolvers); | 46 _jtd_constructor_343_impl(resolvers); |
| 47 } | 47 } |
| 48 _jtd_constructor_343_impl(List<UriResolver> resolvers) { | 48 _jtd_constructor_343_impl(List<UriResolver> resolvers) { |
| 49 _jtd_constructor_342_impl(new ContentCache(), resolvers); | 49 _jtd_constructor_342_impl(new ContentCache(), resolvers); |
| 50 } | 50 } |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Return a source object representing the given absolute URI, or {@code null}
if the URI is not a | 53 * 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. | 54 * valid URI or if it is not an absolute URI. |
| 55 * @param absoluteUri the absolute URI to be resolved | 55 * @param absoluteUri the absolute URI to be resolved |
| 56 * @return a source object representing the absolute URI | 56 * @return a source object representing the absolute URI |
| 57 */ | 57 */ |
| 58 Source forUri(String absoluteUri) { | 58 Source forUri(String absoluteUri) { |
| 59 try { | 59 try { |
| 60 Uri uri = parseUriWithException(absoluteUri); | 60 Uri uri = parseUriWithException(absoluteUri); |
| 61 if (uri.isAbsolute) { | 61 if (uri.isAbsolute) { |
| 62 return resolveUri2(null, uri); | 62 return resolveUri2(null, uri); |
| 63 } | 63 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 */ | 101 */ |
| 102 ContentCache get contentCache => _contentCache; | 102 ContentCache get contentCache => _contentCache; |
| 103 | 103 |
| 104 /** | 104 /** |
| 105 * Return the analysis context that this source factory is associated with. | 105 * Return the analysis context that this source factory is associated with. |
| 106 * @return the analysis context that this source factory is associated with | 106 * @return the analysis context that this source factory is associated with |
| 107 */ | 107 */ |
| 108 AnalysisContext get context => _context; | 108 AnalysisContext get context => _context; |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Return the {@link DartSdk} associated with this {@link SourceFactory}, or {
@code null} if there | 111 * Return the [DartSdk] associated with this [SourceFactory], or `null` if the
re |
| 112 * is no such SDK. | 112 * is no such SDK. |
| 113 * @return the {@link DartSdk} associated with this {@link SourceFactory}, or
{@code null} if | 113 * @return the [DartSdk] associated with this [SourceFactory], or `null` if |
| 114 * there is no such SDK | 114 * there is no such SDK |
| 115 */ | 115 */ |
| 116 DartSdk get dartSdk { | 116 DartSdk get dartSdk { |
| 117 for (UriResolver resolver in _resolvers) { | 117 for (UriResolver resolver in _resolvers) { |
| 118 if (resolver is DartUriResolver) { | 118 if (resolver is DartUriResolver) { |
| 119 DartUriResolver dartUriResolver = resolver as DartUriResolver; | 119 DartUriResolver dartUriResolver = resolver as DartUriResolver; |
| 120 return dartUriResolver.dartSdk; | 120 return dartUriResolver.dartSdk; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 return null; | 123 return null; |
| 124 } | 124 } |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * Return a source object representing the URI that results from resolving the
given (possibly | 127 * 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{@code null} if either the contained URI is invalid or if it cannot be
resolved against the | 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 |
| 129 * source object's URI. | 129 * source object's URI. |
| 130 * @param containingSource the source containing the given URI | 130 * @param containingSource the source containing the given URI |
| 131 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 131 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
| 132 * @return the source representing the contained URI | 132 * @return the source representing the contained URI |
| 133 */ | 133 */ |
| 134 Source resolveUri(Source containingSource, String containedUri) { | 134 Source resolveUri(Source containingSource, String containedUri) { |
| 135 try { | 135 try { |
| 136 return resolveUri2(containingSource, parseUriWithException(containedUri)); | 136 return resolveUri2(containingSource, parseUriWithException(containedUri)); |
| 137 } on URISyntaxException catch (exception) { | 137 } on URISyntaxException catch (exception) { |
| 138 return null; | 138 return null; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 /** | 142 /** |
| 143 * Return an absolute URI that represents the given source. | 143 * Return an absolute URI that represents the given source. |
| 144 * @param source the source to get URI for | 144 * @param source the source to get URI for |
| 145 * @return the absolute URI representing the given source, may be {@code null} | 145 * @return the absolute URI representing the given source, may be `null` |
| 146 */ | 146 */ |
| 147 Uri restoreUri(Source source) { | 147 Uri restoreUri(Source source) { |
| 148 for (UriResolver resolver in _resolvers) { | 148 for (UriResolver resolver in _resolvers) { |
| 149 Uri uri = resolver.restoreAbsolute(source); | 149 Uri uri = resolver.restoreAbsolute(source); |
| 150 if (uri != null) { | 150 if (uri != null) { |
| 151 return uri; | 151 return uri; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 return null; | 154 return null; |
| 155 } | 155 } |
| 156 | 156 |
| 157 /** | 157 /** |
| 158 * Set the contents of the given source to the given contents. This has the ef
fect of overriding | 158 * 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 {@code null} the ov
erride is removed so | 159 * the default contents of the source. If the contents are `null` the override
is removed so |
| 160 * that the default contents will be returned. | 160 * that the default contents will be returned. |
| 161 * @param source the source whose contents are being overridden | 161 * @param source the source whose contents are being overridden |
| 162 * @param contents the new contents of the source | 162 * @param contents the new contents of the source |
| 163 */ | 163 */ |
| 164 void setContents(Source source, String contents) { | 164 void setContents(Source source, String contents) { |
| 165 _contentCache.setContents(source, contents); | 165 _contentCache.setContents(source, contents); |
| 166 } | 166 } |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * Set the analysis context that this source factory is associated with to the
given context. | 169 * Set the analysis context that this source factory is associated with to the
given context. |
| 170 * <p> | 170 * |
| 171 * <b>Note:</b> This method should only be invoked by{@link AnalysisContextImp
l#setSourceFactory(SourceFactory)} and is only public out of | 171 * <b>Note:</b> This method should only be invoked by[AnalysisContextImpl#setS
ourceFactory] and is only public out of |
| 172 * necessity. | 172 * necessity. |
| 173 * @param context the analysis context that this source factory is associated
with | 173 * @param context the analysis context that this source factory is associated
with |
| 174 */ | 174 */ |
| 175 void set context(AnalysisContext context2) { | 175 void set context(AnalysisContext context2) { |
| 176 this._context = context2; | 176 this._context = context2; |
| 177 } | 177 } |
| 178 | 178 |
| 179 /** | 179 /** |
| 180 * Return the contents of the given source, or {@code null} if this factory do
es not override the | 180 * Return the contents of the given source, or `null` if this factory does not
override the |
| 181 * contents of the source. | 181 * contents of the source. |
| 182 * <p> | 182 * |
| 183 * <b>Note:</b> This method is not intended to be used except by{@link FileBas
edSource#getContents(com.google.dart.engine.source.Source.ContentReceiver)}. | 183 * <b>Note:</b> This method is not intended to be used except by[FileBasedSour
ce#getContents]. |
| 184 * @param source the source whose content is to be returned | 184 * @param source the source whose content is to be returned |
| 185 * @return the contents of the given source | 185 * @return the contents of the given source |
| 186 */ | 186 */ |
| 187 String getContents(Source source) => _contentCache.getContents(source); | 187 String getContents(Source source) => _contentCache.getContents(source); |
| 188 | 188 |
| 189 /** | 189 /** |
| 190 * Return the modification stamp of the given source, or {@code null} if this
factory does not | 190 * Return the modification stamp of the given source, or `null` if this factor
y does not |
| 191 * override the contents of the source. | 191 * override the contents of the source. |
| 192 * <p> | 192 * |
| 193 * <b>Note:</b> This method is not intended to be used except by{@link FileBas
edSource#getModificationStamp()}. | 193 * <b>Note:</b> This method is not intended to be used except by[FileBasedSour
ce#getModificationStamp]. |
| 194 * @param source the source whose modification stamp is to be returned | 194 * @param source the source whose modification stamp is to be returned |
| 195 * @return the modification stamp of the given source | 195 * @return the modification stamp of the given source |
| 196 */ | 196 */ |
| 197 int getModificationStamp(Source source) => _contentCache.getModificationStamp(
source); | 197 int getModificationStamp(Source source) => _contentCache.getModificationStamp(
source); |
| 198 | 198 |
| 199 /** | 199 /** |
| 200 * Return a source object representing the URI that results from resolving the
given (possibly | 200 * 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{@code null} if either the contained URI is invalid or if it cannot be
resolved against the | 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 |
| 202 * source object's URI. | 202 * source object's URI. |
| 203 * @param containingSource the source containing the given URI | 203 * @param containingSource the source containing the given URI |
| 204 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 204 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
| 205 * @return the source representing the contained URI | 205 * @return the source representing the contained URI |
| 206 */ | 206 */ |
| 207 Source resolveUri2(Source containingSource, Uri containedUri) { | 207 Source resolveUri2(Source containingSource, Uri containedUri) { |
| 208 if (containedUri.isAbsolute) { | 208 if (containedUri.isAbsolute) { |
| 209 for (UriResolver resolver in _resolvers) { | 209 for (UriResolver resolver in _resolvers) { |
| 210 Source result = resolver.resolveAbsolute(_contentCache, containedUri); | 210 Source result = resolver.resolveAbsolute(_contentCache, containedUri); |
| 211 if (result != null) { | 211 if (result != null) { |
| 212 return result; | 212 return result; |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 return null; | 215 return null; |
| 216 } else { | 216 } else { |
| 217 return containingSource.resolveRelative(containedUri); | 217 return containingSource.resolveRelative(containedUri); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 /** | 221 /** |
| 222 * The abstract class {@code UriResolver} defines the behavior of objects that a
re used to resolve | 222 * 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 | 223 * URI's for a source factory. Subclasses of this class are expected to resolve
a single scheme of |
| 224 * absolute URI. | 224 * absolute URI. |
| 225 * @coverage dart.engine.source | 225 * @coverage dart.engine.source |
| 226 */ | 226 */ |
| 227 abstract class UriResolver { | 227 abstract class UriResolver { |
| 228 | 228 |
| 229 /** | 229 /** |
| 230 * If this resolver should be used for URI's of the given kind, resolve the gi
ven absolute URI. | 230 * 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{@link Source source} representing the file to which it was
resolved, or {@code null} if it | 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 |
| 232 * could not be resolved. | 232 * could not be resolved. |
| 233 * @param contentCache the content cache used to access the contents of the re
turned source | 233 * @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 | 234 * @param kind the kind of URI that was originally resolved in order to produc
e an encoding with |
| 235 * the given URI | 235 * the given URI |
| 236 * @param uri the URI to be resolved | 236 * @param uri the URI to be resolved |
| 237 * @return a {@link Source source} representing the file to which given URI wa
s resolved | 237 * @return a [Source source] representing the file to which given URI was reso
lved |
| 238 */ | 238 */ |
| 239 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri); | 239 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri); |
| 240 | 240 |
| 241 /** | 241 /** |
| 242 * Resolve the given absolute URI. Return a {@link Source source} representing
the file to which | 242 * Resolve the given absolute URI. Return a [Source source] representing the f
ile to which |
| 243 * it was resolved, or {@code null} if it could not be resolved. | 243 * it was resolved, or `null` if it could not be resolved. |
| 244 * @param contentCache the content cache used to access the contents of the re
turned source | 244 * @param contentCache the content cache used to access the contents of the re
turned source |
| 245 * @param uri the URI to be resolved | 245 * @param uri the URI to be resolved |
| 246 * @return a {@link Source source} representing the file to which given URI wa
s resolved | 246 * @return a [Source source] representing the file to which given URI was reso
lved |
| 247 */ | 247 */ |
| 248 Source resolveAbsolute(ContentCache contentCache, Uri uri); | 248 Source resolveAbsolute(ContentCache contentCache, Uri uri); |
| 249 | 249 |
| 250 /** | 250 /** |
| 251 * Return an absolute URI that represents the given source. | 251 * Return an absolute URI that represents the given source. |
| 252 * @param source the source to get URI for | 252 * @param source the source to get URI for |
| 253 * @return the absolute URI representing the given source, may be {@code null} | 253 * @return the absolute URI representing the given source, may be `null` |
| 254 */ | 254 */ |
| 255 Uri restoreAbsolute(Source source) => null; | 255 Uri restoreAbsolute(Source source) => null; |
| 256 } | 256 } |
| 257 /** | 257 /** |
| 258 * The interface {@code Source} defines the behavior of objects representing sou
rce code that can be | 258 * The interface `Source` defines the behavior of objects representing source co
de that can be |
| 259 * compiled. | 259 * compiled. |
| 260 * @coverage dart.engine.source | 260 * @coverage dart.engine.source |
| 261 */ | 261 */ |
| 262 abstract class Source { | 262 abstract class Source { |
| 263 | 263 |
| 264 /** | 264 /** |
| 265 * An empty array of sources. | 265 * An empty array of sources. |
| 266 */ | 266 */ |
| 267 static final List<Source> EMPTY_ARRAY = new List<Source>(0); | 267 static final List<Source> EMPTY_ARRAY = new List<Source>(0); |
| 268 | 268 |
| 269 /** | 269 /** |
| 270 * Return {@code true} if the given object is a source that represents the sam
e source code as | 270 * Return `true` if the given object is a source that represents the same sour
ce code as |
| 271 * this source. | 271 * this source. |
| 272 * @param object the object to be compared with this object | 272 * @param object the object to be compared with this object |
| 273 * @return {@code true} if the given object is a source that represents the sa
me source code as | 273 * @return `true` if the given object is a source that represents the same sou
rce code as |
| 274 * this source | 274 * this source |
| 275 * @see Object#equals(Object) | 275 * @see Object#equals(Object) |
| 276 */ | 276 */ |
| 277 bool operator ==(Object object); | 277 bool operator ==(Object object); |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * Return {@code true} if this source exists. | 280 * Return `true` if this source exists. |
| 281 * @return {@code true} if this source exists | 281 * @return `true` if this source exists |
| 282 */ | 282 */ |
| 283 bool exists(); | 283 bool exists(); |
| 284 | 284 |
| 285 /** | 285 /** |
| 286 * Get the contents of this source and pass it to the given receiver. Exactly
one of the methods | 286 * 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 | 287 * 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. | 288 * 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. | 289 * Whichever method is invoked, it will be invoked before this method returns. |
| 290 * @param receiver the content receiver to which the content of this source wi
ll be passed | 290 * @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 | 291 * @throws Exception if the contents of this source could not be accessed |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 UriKind get uriKind; | 335 UriKind get uriKind; |
| 336 | 336 |
| 337 /** | 337 /** |
| 338 * Return a hash code for this source. | 338 * Return a hash code for this source. |
| 339 * @return a hash code for this source | 339 * @return a hash code for this source |
| 340 * @see Object#hashCode() | 340 * @see Object#hashCode() |
| 341 */ | 341 */ |
| 342 int get hashCode; | 342 int get hashCode; |
| 343 | 343 |
| 344 /** | 344 /** |
| 345 * Return {@code true} if this source is in one of the system libraries. | 345 * Return `true` if this source is in one of the system libraries. |
| 346 * @return {@code true} if this is in a system library | 346 * @return `true` if this is in a system library |
| 347 */ | 347 */ |
| 348 bool isInSystemLibrary(); | 348 bool isInSystemLibrary(); |
| 349 | 349 |
| 350 /** | 350 /** |
| 351 * Resolve the relative URI against the URI associated with this source object
. Return a{@link Source source} representing the URI to which it was resolved, o
r {@code null} if it | 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 |
| 352 * could not be resolved. | 352 * could not be resolved. |
| 353 * <p> | 353 * |
| 354 * Note: This method is not intended for public use, it is only visible out of
necessity. It is | 354 * 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 {@link SourceFactory source factory}. Sour
ce factories will | 355 * only intended to be invoked by a [SourceFactory source factory]. Source fac
tories will |
| 356 * only invoke this method if the URI is relative, so implementations of this
method are not | 356 * 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 | 357 * 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. | 358 * an absolute URI is intentionally left unspecified. |
| 359 * @param relativeUri the relative URI to be resolved against the containing s
ource | 359 * @param relativeUri the relative URI to be resolved against the containing s
ource |
| 360 * @return a {@link Source source} representing the URI to which given URI was
resolved | 360 * @return a [Source source] representing the URI to which given URI was resol
ved |
| 361 */ | 361 */ |
| 362 Source resolveRelative(Uri relativeUri); | 362 Source resolveRelative(Uri relativeUri); |
| 363 } | 363 } |
| 364 /** | 364 /** |
| 365 * The interface {@code ContentReceiver} defines the behavior of objects that ca
n receive the | 365 * The interface `ContentReceiver` defines the behavior of objects that can rece
ive the |
| 366 * content of a source. | 366 * content of a source. |
| 367 */ | 367 */ |
| 368 abstract class Source_ContentReceiver { | 368 abstract class Source_ContentReceiver { |
| 369 | 369 |
| 370 /** | 370 /** |
| 371 * Accept the contents of a source represented as a character buffer. | 371 * Accept the contents of a source represented as a character buffer. |
| 372 * @param contents the contents of the source | 372 * @param contents the contents of the source |
| 373 * @param modificationTime the time at which the contents were last set | 373 * @param modificationTime the time at which the contents were last set |
| 374 */ | 374 */ |
| 375 void accept(CharBuffer contents, int modificationTime); | 375 void accept(CharBuffer contents, int modificationTime); |
| 376 | 376 |
| 377 /** | 377 /** |
| 378 * Accept the contents of a source represented as a string. | 378 * Accept the contents of a source represented as a string. |
| 379 * @param contents the contents of the source | 379 * @param contents the contents of the source |
| 380 * @param modificationTime the time at which the contents were last set | 380 * @param modificationTime the time at which the contents were last set |
| 381 */ | 381 */ |
| 382 void accept2(String contents, int modificationTime); | 382 void accept2(String contents, int modificationTime); |
| 383 } | 383 } |
| 384 /** | 384 /** |
| 385 * The enumeration {@code SourceKind} defines the different kinds of sources tha
t are known to the | 385 * The enumeration `SourceKind` defines the different kinds of sources that are
known to the |
| 386 * analysis engine. | 386 * analysis engine. |
| 387 * @coverage dart.engine.source | 387 * @coverage dart.engine.source |
| 388 */ | 388 */ |
| 389 class SourceKind implements Comparable<SourceKind> { | 389 class SourceKind implements Comparable<SourceKind> { |
| 390 | 390 |
| 391 /** | 391 /** |
| 392 * A source containing HTML. The HTML might or might not contain Dart scripts. | 392 * A source containing HTML. The HTML might or might not contain Dart scripts. |
| 393 */ | 393 */ |
| 394 static final SourceKind HTML = new SourceKind('HTML', 0); | 394 static final SourceKind HTML = new SourceKind('HTML', 0); |
| 395 | 395 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 417 | 417 |
| 418 /// The position in the enum declaration. | 418 /// The position in the enum declaration. |
| 419 final int ordinal; | 419 final int ordinal; |
| 420 SourceKind(this.name, this.ordinal) { | 420 SourceKind(this.name, this.ordinal) { |
| 421 } | 421 } |
| 422 int compareTo(SourceKind other) => ordinal - other.ordinal; | 422 int compareTo(SourceKind other) => ordinal - other.ordinal; |
| 423 int get hashCode => ordinal; | 423 int get hashCode => ordinal; |
| 424 String toString() => name; | 424 String toString() => name; |
| 425 } | 425 } |
| 426 /** | 426 /** |
| 427 * The enumeration {@code UriKind} defines the different kinds of URI's that are
known to the | 427 * 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. | 428 * analysis engine. These are used to keep track of the kind of URI associated w
ith a given source. |
| 429 * @coverage dart.engine.source | 429 * @coverage dart.engine.source |
| 430 */ | 430 */ |
| 431 class UriKind implements Comparable<UriKind> { | 431 class UriKind implements Comparable<UriKind> { |
| 432 | 432 |
| 433 /** | 433 /** |
| 434 * A 'dart:' URI. | 434 * A 'dart:' URI. |
| 435 */ | 435 */ |
| 436 static final UriKind DART_URI = new UriKind('DART_URI', 0, 0x64); | 436 static final UriKind DART_URI = new UriKind('DART_URI', 0, 0x64); |
| 437 | 437 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 459 | 459 |
| 460 /** | 460 /** |
| 461 * Initialize a newly created URI kind to have the given encoding. | 461 * Initialize a newly created URI kind to have the given encoding. |
| 462 * @param encoding the single character encoding used to identify this kind of
URI. | 462 * @param encoding the single character encoding used to identify this kind of
URI. |
| 463 */ | 463 */ |
| 464 UriKind(this.name, this.ordinal, int encoding) { | 464 UriKind(this.name, this.ordinal, int encoding) { |
| 465 this._encoding = encoding; | 465 this._encoding = encoding; |
| 466 } | 466 } |
| 467 | 467 |
| 468 /** | 468 /** |
| 469 * Return the URI kind represented by the given encoding, or {@code null} if t
here is no kind with | 469 * Return the URI kind represented by the given encoding, or `null` if there i
s no kind with |
| 470 * the given encoding. | 470 * the given encoding. |
| 471 * @param encoding the single character encoding used to identify the URI kind
to be returned | 471 * @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 | 472 * @return the URI kind represented by the given encoding |
| 473 */ | 473 */ |
| 474 static UriKind fromEncoding(int encoding) { | 474 static UriKind fromEncoding(int encoding) { |
| 475 while (true) { | 475 while (true) { |
| 476 if (encoding == 0x64) { | 476 if (encoding == 0x64) { |
| 477 return DART_URI; | 477 return DART_URI; |
| 478 } else if (encoding == 0x66) { | 478 } else if (encoding == 0x66) { |
| 479 return FILE_URI; | 479 return FILE_URI; |
| 480 } else if (encoding == 0x70) { | 480 } else if (encoding == 0x70) { |
| 481 return PACKAGE_URI; | 481 return PACKAGE_URI; |
| 482 } | 482 } |
| 483 break; | 483 break; |
| 484 } | 484 } |
| 485 return null; | 485 return null; |
| 486 } | 486 } |
| 487 | 487 |
| 488 /** | 488 /** |
| 489 * Return the single character encoding used to identify this kind of URI. | 489 * Return the single character encoding used to identify this kind of URI. |
| 490 * @return the single character encoding used to identify this kind of URI | 490 * @return the single character encoding used to identify this kind of URI |
| 491 */ | 491 */ |
| 492 int get encoding => _encoding; | 492 int get encoding => _encoding; |
| 493 int compareTo(UriKind other) => ordinal - other.ordinal; | 493 int compareTo(UriKind other) => ordinal - other.ordinal; |
| 494 int get hashCode => ordinal; | 494 int get hashCode => ordinal; |
| 495 String toString() => name; | 495 String toString() => name; |
| 496 } | 496 } |
| 497 /** | 497 /** |
| 498 * A source range defines an {@link Element}'s source coordinates relative to it
s {@link Source}. | 498 * A source range defines an [Element]'s source coordinates relative to its [Sou
rce]. |
| 499 * @coverage dart.engine.utilities | 499 * @coverage dart.engine.utilities |
| 500 */ | 500 */ |
| 501 class SourceRange { | 501 class SourceRange { |
| 502 | 502 |
| 503 /** | 503 /** |
| 504 * The 0-based index of the first character of the source code for this elemen
t, relative to the | 504 * 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. | 505 * source buffer in which this element is contained. |
| 506 */ | 506 */ |
| 507 int _offset = 0; | 507 int _offset = 0; |
| 508 | 508 |
| 509 /** | 509 /** |
| 510 * The number of characters of the source code for this element, relative to t
he source buffer in | 510 * The number of characters of the source code for this element, relative to t
he source buffer in |
| 511 * which this element is contained. | 511 * which this element is contained. |
| 512 */ | 512 */ |
| 513 int _length = 0; | 513 int _length = 0; |
| 514 | 514 |
| 515 /** | 515 /** |
| 516 * Initialize a newly created source range using the given offset and the give
n length. | 516 * Initialize a newly created source range using the given offset and the give
n length. |
| 517 * @param offset the given offset | 517 * @param offset the given offset |
| 518 * @param length the given length | 518 * @param length the given length |
| 519 */ | 519 */ |
| 520 SourceRange(int offset, int length) { | 520 SourceRange(int offset, int length) { |
| 521 this._offset = offset; | 521 this._offset = offset; |
| 522 this._length = length; | 522 this._length = length; |
| 523 } | 523 } |
| 524 | 524 |
| 525 /** | 525 /** |
| 526 * @return {@code true} if <code>x</code> is in \[offset, offset + length) int
erval. | 526 * @return `true` if <code>x</code> is in \[offset, offset + length) interval. |
| 527 */ | 527 */ |
| 528 bool contains(int x) => _offset <= x && x < _offset + _length; | 528 bool contains(int x) => _offset <= x && x < _offset + _length; |
| 529 | 529 |
| 530 /** | 530 /** |
| 531 * @return {@code true} if <code>x</code> is in (offset, offset + length) inte
rval. | 531 * @return `true` if <code>x</code> is in (offset, offset + length) interval. |
| 532 */ | 532 */ |
| 533 bool containsExclusive(int x) => _offset < x && x < _offset + _length; | 533 bool containsExclusive(int x) => _offset < x && x < _offset + _length; |
| 534 | 534 |
| 535 /** | 535 /** |
| 536 * @return {@code true} if <code>otherRange</code> covers this {@link SourceRa
nge}. | 536 * @return `true` if <code>otherRange</code> covers this [SourceRange]. |
| 537 */ | 537 */ |
| 538 bool coveredBy(SourceRange otherRange) => otherRange.covers(this); | 538 bool coveredBy(SourceRange otherRange) => otherRange.covers(this); |
| 539 | 539 |
| 540 /** | 540 /** |
| 541 * @return {@code true} if this {@link SourceRange} covers <code>otherRange</c
ode>. | 541 * @return `true` if this [SourceRange] covers <code>otherRange</code>. |
| 542 */ | 542 */ |
| 543 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; | 543 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; |
| 544 | 544 |
| 545 /** | 545 /** |
| 546 * @return {@code true} if this {@link SourceRange} ends in <code>otherRange</
code>. | 546 * @return `true` if this [SourceRange] ends in <code>otherRange</code>. |
| 547 */ | 547 */ |
| 548 bool endsIn(SourceRange otherRange) { | 548 bool endsIn(SourceRange otherRange) { |
| 549 int thisEnd = end; | 549 int thisEnd = end; |
| 550 return otherRange.contains(thisEnd); | 550 return otherRange.contains(thisEnd); |
| 551 } | 551 } |
| 552 bool operator ==(Object obj) { | 552 bool operator ==(Object obj) { |
| 553 if (obj is! SourceRange) { | 553 if (obj is! SourceRange) { |
| 554 return false; | 554 return false; |
| 555 } | 555 } |
| 556 SourceRange sourceRange = obj as SourceRange; | 556 SourceRange sourceRange = obj as SourceRange; |
| 557 return sourceRange.offset == _offset && sourceRange.length == _length; | 557 return sourceRange.offset == _offset && sourceRange.length == _length; |
| 558 } | 558 } |
| 559 | 559 |
| 560 /** | 560 /** |
| 561 * @return the 0-based index of the after-last character of the source code fo
r this element, | 561 * @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. | 562 * relative to the source buffer in which this element is contained. |
| 563 */ | 563 */ |
| 564 int get end => _offset + _length; | 564 int get end => _offset + _length; |
| 565 | 565 |
| 566 /** | 566 /** |
| 567 * @return the expanded instance of {@link SourceRange}, which has the same ce
nter. | 567 * @return the expanded instance of [SourceRange], which has the same center. |
| 568 */ | 568 */ |
| 569 SourceRange getExpanded(int delta) => new SourceRange(_offset - delta, delta +
_length + delta); | 569 SourceRange getExpanded(int delta) => new SourceRange(_offset - delta, delta +
_length + delta); |
| 570 | 570 |
| 571 /** | 571 /** |
| 572 * Returns the number of characters of the source code for this element, relat
ive to the source | 572 * 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. | 573 * buffer in which this element is contained. |
| 574 * @return the number of characters of the source code for this element, relat
ive to the source | 574 * @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 | 575 * buffer in which this element is contained |
| 576 */ | 576 */ |
| 577 int get length => _length; | 577 int get length => _length; |
| 578 | 578 |
| 579 /** | 579 /** |
| 580 * @return the instance of {@link SourceRange} with end moved on "delta". | 580 * @return the instance of [SourceRange] with end moved on "delta". |
| 581 */ | 581 */ |
| 582 SourceRange getMoveEnd(int delta) => new SourceRange(_offset, _length + delta)
; | 582 SourceRange getMoveEnd(int delta) => new SourceRange(_offset, _length + delta)
; |
| 583 | 583 |
| 584 /** | 584 /** |
| 585 * Returns the 0-based index of the first character of the source code for thi
s element, relative | 585 * 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. | 586 * to the source buffer in which this element is contained. |
| 587 * @return the 0-based index of the first character of the source code for thi
s element, relative | 587 * @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 | 588 * to the source buffer in which this element is contained |
| 589 */ | 589 */ |
| 590 int get offset => _offset; | 590 int get offset => _offset; |
| 591 | 591 |
| 592 /** | 592 /** |
| 593 * @return the expanded translated of {@link SourceRange}, with moved start an
d the same length. | 593 * @return the expanded translated of [SourceRange], with moved start and the
same length. |
| 594 */ | 594 */ |
| 595 SourceRange getTranslated(int delta) => new SourceRange(_offset + delta, _leng
th); | 595 SourceRange getTranslated(int delta) => new SourceRange(_offset + delta, _leng
th); |
| 596 int get hashCode => 31 * _offset + _length; | 596 int get hashCode => 31 * _offset + _length; |
| 597 | 597 |
| 598 /** | 598 /** |
| 599 * @return {@code true} if this {@link SourceRange} intersects with given. | 599 * @return `true` if this [SourceRange] intersects with given. |
| 600 */ | 600 */ |
| 601 bool intersects(SourceRange other) { | 601 bool intersects(SourceRange other) { |
| 602 if (other == null) { | 602 if (other == null) { |
| 603 return false; | 603 return false; |
| 604 } | 604 } |
| 605 if (end <= other.offset) { | 605 if (end <= other.offset) { |
| 606 return false; | 606 return false; |
| 607 } | 607 } |
| 608 if (offset >= other.end) { | 608 if (offset >= other.end) { |
| 609 return false; | 609 return false; |
| 610 } | 610 } |
| 611 return true; | 611 return true; |
| 612 } | 612 } |
| 613 | 613 |
| 614 /** | 614 /** |
| 615 * @return {@code true} if this {@link SourceRange} starts in <code>otherRange
</code>. | 615 * @return `true` if this [SourceRange] starts in <code>otherRange</code>. |
| 616 */ | 616 */ |
| 617 bool startsIn(SourceRange otherRange) => otherRange.contains(_offset); | 617 bool startsIn(SourceRange otherRange) => otherRange.contains(_offset); |
| 618 String toString() { | 618 String toString() { |
| 619 JavaStringBuilder builder = new JavaStringBuilder(); | 619 JavaStringBuilder builder = new JavaStringBuilder(); |
| 620 builder.append("[offset="); | 620 builder.append("[offset="); |
| 621 builder.append(_offset); | 621 builder.append(_offset); |
| 622 builder.append(", length="); | 622 builder.append(", length="); |
| 623 builder.append(_length); | 623 builder.append(_length); |
| 624 builder.append("]"); | 624 builder.append("]"); |
| 625 return builder.toString(); | 625 return builder.toString(); |
| 626 } | 626 } |
| 627 } | 627 } |
| 628 /** | 628 /** |
| 629 * The interface {@code SourceContainer} is used by clients to define a collecti
on of sources | 629 * The interface `SourceContainer` is used by clients to define a collection of
sources |
| 630 * <p> | 630 * |
| 631 * Source containers are not used within analysis engine, but can be used by cli
ents to group | 631 * 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 | 632 * 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 | 633 * client uses source containers to represent Eclipse projects, which allows it
to easily compute |
| 634 * project-level dependencies. | 634 * project-level dependencies. |
| 635 * @coverage dart.engine.source | 635 * @coverage dart.engine.source |
| 636 */ | 636 */ |
| 637 abstract class SourceContainer { | 637 abstract class SourceContainer { |
| 638 | 638 |
| 639 /** | 639 /** |
| 640 * Determine if the specified source is part of the receiver's collection of s
ources. | 640 * Determine if the specified source is part of the receiver's collection of s
ources. |
| 641 * @param source the source in question | 641 * @param source the source in question |
| 642 * @return {@code true} if the receiver contains the source, else {@code false
} | 642 * @return `true` if the receiver contains the source, else `false` |
| 643 */ | 643 */ |
| 644 bool contains(Source source); | 644 bool contains(Source source); |
| 645 } | 645 } |
| 646 /** | 646 /** |
| 647 * Instances of the class {@code DartUriResolver} resolve {@code dart} URI's. | 647 * Instances of the class `DartUriResolver` resolve `dart` URI's. |
| 648 * @coverage dart.engine.source | 648 * @coverage dart.engine.source |
| 649 */ | 649 */ |
| 650 class DartUriResolver extends UriResolver { | 650 class DartUriResolver extends UriResolver { |
| 651 | 651 |
| 652 /** | 652 /** |
| 653 * The Dart SDK against which URI's are to be resolved. | 653 * The Dart SDK against which URI's are to be resolved. |
| 654 */ | 654 */ |
| 655 DartSdk _sdk; | 655 DartSdk _sdk; |
| 656 | 656 |
| 657 /** | 657 /** |
| 658 * The name of the {@code dart} scheme. | 658 * The name of the `dart` scheme. |
| 659 */ | 659 */ |
| 660 static String _DART_SCHEME = "dart"; | 660 static String _DART_SCHEME = "dart"; |
| 661 | 661 |
| 662 /** | 662 /** |
| 663 * Return {@code true} if the given URI is a {@code dart:} URI. | 663 * Return `true` if the given URI is a `dart:` URI. |
| 664 * @param uri the URI being tested | 664 * @param uri the URI being tested |
| 665 * @return {@code true} if the given URI is a {@code dart:} URI | 665 * @return `true` if the given URI is a `dart:` URI |
| 666 */ | 666 */ |
| 667 static bool isDartUri(Uri uri) => _DART_SCHEME == uri.scheme; | 667 static bool isDartUri(Uri uri) => _DART_SCHEME == uri.scheme; |
| 668 | 668 |
| 669 /** | 669 /** |
| 670 * Initialize a newly created resolver to resolve Dart URI's against the given
platform within the | 670 * Initialize a newly created resolver to resolve Dart URI's against the given
platform within the |
| 671 * given Dart SDK. | 671 * given Dart SDK. |
| 672 * @param sdk the Dart SDK against which URI's are to be resolved | 672 * @param sdk the Dart SDK against which URI's are to be resolved |
| 673 */ | 673 */ |
| 674 DartUriResolver(DartSdk sdk) { | 674 DartUriResolver(DartSdk sdk) { |
| 675 this._sdk = sdk; | 675 this._sdk = sdk; |
| 676 } | 676 } |
| 677 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) { | 677 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) { |
| 678 if (identical(kind, UriKind.DART_URI)) { | 678 if (identical(kind, UriKind.DART_URI)) { |
| 679 return _sdk.fromEncoding(contentCache, kind, uri); | 679 return _sdk.fromEncoding(contentCache, kind, uri); |
| 680 } | 680 } |
| 681 return null; | 681 return null; |
| 682 } | 682 } |
| 683 | 683 |
| 684 /** | 684 /** |
| 685 * Return the {@link DartSdk} against which URIs are to be resolved. | 685 * Return the [DartSdk] against which URIs are to be resolved. |
| 686 * @return the {@link DartSdk} against which URIs are to be resolved. | 686 * @return the [DartSdk] against which URIs are to be resolved. |
| 687 */ | 687 */ |
| 688 DartSdk get dartSdk => _sdk; | 688 DartSdk get dartSdk => _sdk; |
| 689 Source resolveAbsolute(ContentCache contentCache, Uri uri) { | 689 Source resolveAbsolute(ContentCache contentCache, Uri uri) { |
| 690 if (!isDartUri(uri)) { | 690 if (!isDartUri(uri)) { |
| 691 return null; | 691 return null; |
| 692 } | 692 } |
| 693 return _sdk.mapDartUri(contentCache, uri.toString()); | 693 return _sdk.mapDartUri(contentCache, uri.toString()); |
| 694 } | 694 } |
| 695 } | 695 } |
| 696 /** | 696 /** |
| 697 * Instances of the class {@code LineInfo} encapsulate information about line an
d column information | 697 * Instances of the class `LineInfo` encapsulate information about line and colu
mn information |
| 698 * within a source file. | 698 * within a source file. |
| 699 * @coverage dart.engine.utilities | 699 * @coverage dart.engine.utilities |
| 700 */ | 700 */ |
| 701 class LineInfo { | 701 class LineInfo { |
| 702 | 702 |
| 703 /** | 703 /** |
| 704 * An array containing the offsets of the first character of each line in the
source code. | 704 * An array containing the offsets of the first character of each line in the
source code. |
| 705 */ | 705 */ |
| 706 List<int> _lineStarts; | 706 List<int> _lineStarts; |
| 707 | 707 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 728 int lineCount = _lineStarts.length; | 728 int lineCount = _lineStarts.length; |
| 729 for (int i = 1; i < lineCount; i++) { | 729 for (int i = 1; i < lineCount; i++) { |
| 730 if (offset < _lineStarts[i]) { | 730 if (offset < _lineStarts[i]) { |
| 731 return new LineInfo_Location(i, offset - _lineStarts[i - 1] + 1); | 731 return new LineInfo_Location(i, offset - _lineStarts[i - 1] + 1); |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 return new LineInfo_Location(lineCount, offset - _lineStarts[lineCount - 1]
+ 1); | 734 return new LineInfo_Location(lineCount, offset - _lineStarts[lineCount - 1]
+ 1); |
| 735 } | 735 } |
| 736 } | 736 } |
| 737 /** | 737 /** |
| 738 * Instances of the class {@code Location} represent the location of a character
as a line and | 738 * Instances of the class `Location` represent the location of a character as a
line and |
| 739 * column pair. | 739 * column pair. |
| 740 */ | 740 */ |
| 741 class LineInfo_Location { | 741 class LineInfo_Location { |
| 742 | 742 |
| 743 /** | 743 /** |
| 744 * The one-based index of the line containing the character. | 744 * The one-based index of the line containing the character. |
| 745 */ | 745 */ |
| 746 int _lineNumber = 0; | 746 int _lineNumber = 0; |
| 747 | 747 |
| 748 /** | 748 /** |
| (...skipping 18 matching lines...) Expand all Loading... |
| 767 */ | 767 */ |
| 768 int get columnNumber => _columnNumber; | 768 int get columnNumber => _columnNumber; |
| 769 | 769 |
| 770 /** | 770 /** |
| 771 * Return the one-based index of the line containing the character. | 771 * Return the one-based index of the line containing the character. |
| 772 * @return the one-based index of the line containing the character | 772 * @return the one-based index of the line containing the character |
| 773 */ | 773 */ |
| 774 int get lineNumber => _lineNumber; | 774 int get lineNumber => _lineNumber; |
| 775 } | 775 } |
| 776 /** | 776 /** |
| 777 * Instances of class {@code ContentCache} hold content used to override the def
ault content of a{@link Source}. | 777 * Instances of class `ContentCache` hold content used to override the default c
ontent of a[Source]. |
| 778 * @coverage dart.engine.source | 778 * @coverage dart.engine.source |
| 779 */ | 779 */ |
| 780 class ContentCache { | 780 class ContentCache { |
| 781 | 781 |
| 782 /** | 782 /** |
| 783 * A table mapping sources to the contents of those sources. This is used to o
verride the default | 783 * A table mapping sources to the contents of those sources. This is used to o
verride the default |
| 784 * contents of a source. | 784 * contents of a source. |
| 785 */ | 785 */ |
| 786 Map<Source, String> _contentMap = new Map<Source, String>(); | 786 Map<Source, String> _contentMap = new Map<Source, String>(); |
| 787 | 787 |
| 788 /** | 788 /** |
| 789 * A table mapping sources to the modification stamps of those sources. This i
s used when the | 789 * 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. | 790 * default contents of a source has been overridden. |
| 791 */ | 791 */ |
| 792 Map<Source, int> _stampMap = new Map<Source, int>(); | 792 Map<Source, int> _stampMap = new Map<Source, int>(); |
| 793 | 793 |
| 794 /** | 794 /** |
| 795 * Return the contents of the given source, or {@code null} if this cache does
not override the | 795 * Return the contents of the given source, or `null` if this cache does not o
verride the |
| 796 * contents of the source. | 796 * contents of the source. |
| 797 * <p> | 797 * |
| 798 * <b>Note:</b> This method is not intended to be used except by{@link SourceF
actory#getContents(com.google.dart.engine.source.Source.ContentReceiver)}. | 798 * <b>Note:</b> This method is not intended to be used except by[SourceFactory
#getContents]. |
| 799 * @param source the source whose content is to be returned | 799 * @param source the source whose content is to be returned |
| 800 * @return the contents of the given source | 800 * @return the contents of the given source |
| 801 */ | 801 */ |
| 802 String getContents(Source source) => _contentMap[source]; | 802 String getContents(Source source) => _contentMap[source]; |
| 803 | 803 |
| 804 /** | 804 /** |
| 805 * Return the modification stamp of the given source, or {@code null} if this
cache does not | 805 * Return the modification stamp of the given source, or `null` if this cache
does not |
| 806 * override the contents of the source. | 806 * override the contents of the source. |
| 807 * <p> | 807 * |
| 808 * <b>Note:</b> This method is not intended to be used except by{@link SourceF
actory#getModificationStamp(com.google.dart.engine.source.Source)}. | 808 * <b>Note:</b> This method is not intended to be used except by[SourceFactory
#getModificationStamp]. |
| 809 * @param source the source whose modification stamp is to be returned | 809 * @param source the source whose modification stamp is to be returned |
| 810 * @return the modification stamp of the given source | 810 * @return the modification stamp of the given source |
| 811 */ | 811 */ |
| 812 int getModificationStamp(Source source) => _stampMap[source]; | 812 int getModificationStamp(Source source) => _stampMap[source]; |
| 813 | 813 |
| 814 /** | 814 /** |
| 815 * Set the contents of the given source to the given contents. This has the ef
fect of overriding | 815 * 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 {@code null} the ov
erride is removed so | 816 * the default contents of the source. If the contents are `null` the override
is removed so |
| 817 * that the default contents will be returned. | 817 * that the default contents will be returned. |
| 818 * @param source the source whose contents are being overridden | 818 * @param source the source whose contents are being overridden |
| 819 * @param contents the new contents of the source | 819 * @param contents the new contents of the source |
| 820 */ | 820 */ |
| 821 void setContents(Source source, String contents) { | 821 void setContents(Source source, String contents) { |
| 822 if (contents == null) { | 822 if (contents == null) { |
| 823 _contentMap.remove(source); | 823 _contentMap.remove(source); |
| 824 _stampMap.remove(source); | 824 _stampMap.remove(source); |
| 825 } else { | 825 } else { |
| 826 _contentMap[source] = contents; | 826 _contentMap[source] = contents; |
| 827 _stampMap[source] = JavaSystem.currentTimeMillis(); | 827 _stampMap[source] = JavaSystem.currentTimeMillis(); |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 } | 830 } |
| OLD | NEW |