| OLD | NEW |
| (Empty) |
| 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. | |
| 3 | |
| 4 library engine.source; | |
| 5 | |
| 6 import 'dart:uri'; | |
| 7 import 'java_core.dart'; | |
| 8 | |
| 9 /** | |
| 10 * Instances of the class {@code SourceFactory} resolve possibly relative URI's
against an existing{@link Source source}. | |
| 11 * @coverage dart.engine.source | |
| 12 */ | |
| 13 class SourceFactory { | |
| 14 /** | |
| 15 * The resolvers used to resolve absolute URI's. | |
| 16 */ | |
| 17 List<UriResolver> _resolvers; | |
| 18 /** | |
| 19 * A cache of content used to override the default content of a source. | |
| 20 */ | |
| 21 ContentCache _contentCache; | |
| 22 /** | |
| 23 * Initialize a newly created source factory. | |
| 24 * @param contentCache the cache holding content used to override the default
content of a source. | |
| 25 * @param resolvers the resolvers used to resolve absolute URI's | |
| 26 */ | |
| 27 SourceFactory.con1(ContentCache contentCache2, List<UriResolver> resolvers2) { | |
| 28 _jtd_constructor_289_impl(contentCache2, resolvers2); | |
| 29 } | |
| 30 _jtd_constructor_289_impl(ContentCache contentCache2, List<UriResolver> resolv
ers2) { | |
| 31 this._contentCache = contentCache2; | |
| 32 this._resolvers = resolvers2; | |
| 33 } | |
| 34 /** | |
| 35 * Initialize a newly created source factory. | |
| 36 * @param resolvers the resolvers used to resolve absolute URI's | |
| 37 */ | |
| 38 SourceFactory.con2(List<UriResolver> resolvers) { | |
| 39 _jtd_constructor_290_impl(resolvers); | |
| 40 } | |
| 41 _jtd_constructor_290_impl(List<UriResolver> resolvers) { | |
| 42 _jtd_constructor_289_impl(new ContentCache(), resolvers); | |
| 43 } | |
| 44 /** | |
| 45 * Return a source object representing the given absolute URI, or {@code null}
if the URI is not a | |
| 46 * valid URI or if it is not an absolute URI. | |
| 47 * @param absoluteUri the absolute URI to be resolved | |
| 48 * @return a source object representing the absolute URI | |
| 49 */ | |
| 50 Source forUri(String absoluteUri) { | |
| 51 try { | |
| 52 Uri uri = new Uri(absoluteUri); | |
| 53 if (uri.isAbsolute) { | |
| 54 return resolveUri2(null, uri); | |
| 55 } | |
| 56 } on URISyntaxException catch (exception) { | |
| 57 } | |
| 58 return null; | |
| 59 } | |
| 60 /** | |
| 61 * Return a source object that is equal to the source object used to obtain th
e given encoding, or{@code null} if the argument is not a valid encoding. | |
| 62 * @param encoding the encoding of a source object | |
| 63 * @return a source object that is described by the given encoding | |
| 64 * @see Source#getEncoding() | |
| 65 */ | |
| 66 Source fromEncoding(String encoding) => forUri(encoding); | |
| 67 /** | |
| 68 * Return a source object representing the URI that results from resolving the
given (possibly | |
| 69 * 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 | |
| 70 * source object's URI. | |
| 71 * @param containingSource the source containing the given URI | |
| 72 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | |
| 73 * @return the source representing the contained URI | |
| 74 */ | |
| 75 Source resolveUri(Source containingSource, String containedUri) { | |
| 76 try { | |
| 77 return resolveUri2(containingSource, new Uri.fromComponents(path: containe
dUri)); | |
| 78 } on URISyntaxException catch (exception) { | |
| 79 return null; | |
| 80 } | |
| 81 } | |
| 82 /** | |
| 83 * Set the contents of the given source to the given contents. This has the ef
fect of overriding | |
| 84 * the default contents of the source. If the contents are {@code null} the ov
erride is removed so | |
| 85 * that the default contents will be returned. | |
| 86 * @param source the source whose contents are being overridden | |
| 87 * @param contents the new contents of the source | |
| 88 */ | |
| 89 void setContents(Source source, String contents) { | |
| 90 _contentCache.setContents(source, contents); | |
| 91 } | |
| 92 /** | |
| 93 * Return the contents of the given source, or {@code null} if this factory do
es not override the | |
| 94 * contents of the source. | |
| 95 * <p> | |
| 96 * <b>Note:</b> This method is not intended to be used except by{@link FileBas
edSource#getContents(com.google.dart.engine.source.Source.ContentReceiver)}. | |
| 97 * @param source the source whose content is to be returned | |
| 98 * @return the contents of the given source | |
| 99 */ | |
| 100 String getContents(Source source) => _contentCache.getContents(source); | |
| 101 /** | |
| 102 * Return the modification stamp of the given source, or {@code null} if this
factory does not | |
| 103 * override the contents of the source. | |
| 104 * <p> | |
| 105 * <b>Note:</b> This method is not intended to be used except by{@link FileBas
edSource#getModificationStamp()}. | |
| 106 * @param source the source whose modification stamp is to be returned | |
| 107 * @return the modification stamp of the given source | |
| 108 */ | |
| 109 int getModificationStamp(Source source) => _contentCache.getModificationStamp(
source); | |
| 110 /** | |
| 111 * Return a source object representing the URI that results from resolving the
given (possibly | |
| 112 * 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 | |
| 113 * source object's URI. | |
| 114 * @param containingSource the source containing the given URI | |
| 115 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | |
| 116 * @return the source representing the contained URI | |
| 117 */ | |
| 118 Source resolveUri2(Source containingSource, Uri containedUri) { | |
| 119 if (containedUri.isAbsolute) { | |
| 120 for (UriResolver resolver in _resolvers) { | |
| 121 Source result = resolver.resolveAbsolute(this, containedUri); | |
| 122 if (result != null) { | |
| 123 return result; | |
| 124 } | |
| 125 } | |
| 126 return null; | |
| 127 } else { | |
| 128 return containingSource.resolveRelative(containedUri); | |
| 129 } | |
| 130 } | |
| 131 } | |
| 132 /** | |
| 133 * The abstract class {@code UriResolver} defines the behavior of objects that a
re used to resolve | |
| 134 * URI's for a source factory. Subclasses of this class are expected to resolve
a single scheme of | |
| 135 * absolute URI. | |
| 136 * @coverage dart.engine.source | |
| 137 */ | |
| 138 abstract class UriResolver { | |
| 139 /** | |
| 140 * Initialize a newly created resolver. | |
| 141 */ | |
| 142 UriResolver() : super() { | |
| 143 } | |
| 144 /** | |
| 145 * Resolve the given absolute URI. Return a {@link Source source} representing
the file to which | |
| 146 * it was resolved, or {@code null} if it could not be resolved. | |
| 147 * @param uri the URI to be resolved | |
| 148 * @return a {@link Source source} representing the URI to which given URI was
resolved | |
| 149 */ | |
| 150 Source resolveAbsolute(SourceFactory factory, Uri uri); | |
| 151 } | |
| 152 /** | |
| 153 * The interface {@code Source} defines the behavior of objects representing sou
rce code that can be | |
| 154 * compiled. | |
| 155 * @coverage dart.engine.source | |
| 156 */ | |
| 157 abstract class Source { | |
| 158 /** | |
| 159 * An empty array of sources. | |
| 160 */ | |
| 161 static List<Source> EMPTY_ARRAY = new List<Source>(0); | |
| 162 /** | |
| 163 * Return {@code true} if the given object is a source that represents the sam
e source code as | |
| 164 * this source. | |
| 165 * @param object the object to be compared with this object | |
| 166 * @return {@code true} if the given object is a source that represents the sa
me source code as | |
| 167 * this source | |
| 168 * @see Object#equals(Object) | |
| 169 */ | |
| 170 bool operator ==(Object object); | |
| 171 /** | |
| 172 * Return {@code true} if this source exists. | |
| 173 * @return {@code true} if this source exists | |
| 174 */ | |
| 175 bool exists(); | |
| 176 /** | |
| 177 * Get the contents of this source and pass it to the given receiver. Exactly
one of the methods | |
| 178 * defined on the receiver will be invoked unless an exception is thrown. The
method that will be | |
| 179 * invoked depends on which of the possible representations of the contents is
the most efficient. | |
| 180 * Whichever method is invoked, it will be invoked before this method returns. | |
| 181 * @param receiver the content receiver to which the content of this source wi
ll be passed | |
| 182 * @throws Exception if the contents of this source could not be accessed | |
| 183 */ | |
| 184 void getContents(Source_ContentReceiver receiver); | |
| 185 /** | |
| 186 * Return an encoded representation of this source that can be used to create
a source that is | |
| 187 * equal to this source. | |
| 188 * @return an encoded representation of this source | |
| 189 * @see SourceFactory#fromEncoding(String) | |
| 190 */ | |
| 191 String get encoding; | |
| 192 /** | |
| 193 * Return the full (long) version of the name that can be displayed to the use
r to denote this | |
| 194 * source. For example, for a source representing a file this would typically
be the absolute path | |
| 195 * of the file. | |
| 196 * @return a name that can be displayed to the user to denote this source | |
| 197 */ | |
| 198 String get fullName; | |
| 199 /** | |
| 200 * Return the modification stamp for this source. A modification stamp is a no
n-negative integer | |
| 201 * with the property that if the contents of the source have not been modified
since the last time | |
| 202 * the modification stamp was accessed then the same value will be returned, b
ut if the contents | |
| 203 * of the source have been modified one or more times (even if the net change
is zero) the stamps | |
| 204 * will be different. | |
| 205 * @return the modification stamp for this source | |
| 206 */ | |
| 207 int get modificationStamp; | |
| 208 /** | |
| 209 * Return a short version of the name that can be displayed to the user to den
ote this source. For | |
| 210 * example, for a source representing a file this would typically be the name
of the file. | |
| 211 * @return a name that can be displayed to the user to denote this source | |
| 212 */ | |
| 213 String get shortName; | |
| 214 /** | |
| 215 * Return a hash code for this source. | |
| 216 * @return a hash code for this source | |
| 217 * @see Object#hashCode() | |
| 218 */ | |
| 219 int get hashCode; | |
| 220 /** | |
| 221 * Return {@code true} if this source is in one of the system libraries. | |
| 222 * @return {@code true} if this is in a system library | |
| 223 */ | |
| 224 bool isInSystemLibrary(); | |
| 225 /** | |
| 226 * Resolve the given URI relative to the location of this source. | |
| 227 * @param uri the URI to be resolved against this source | |
| 228 * @return a source representing the resolved URI | |
| 229 */ | |
| 230 Source resolve(String uri); | |
| 231 /** | |
| 232 * 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 | |
| 233 * could not be resolved. | |
| 234 * <p> | |
| 235 * Note: This method is not intended for public use, it is only visible out of
necessity. It is | |
| 236 * only intended to be invoked by a {@link SourceFactory source factory}. Sour
ce factories will | |
| 237 * only invoke this method if the URI is relative, so implementations of this
method are not | |
| 238 * required to, and generally do not, verify the argument. The result of invok
ing this method with | |
| 239 * an absolute URI is intentionally left unspecified. | |
| 240 * @param relativeUri the relative URI to be resolved against the containing s
ource | |
| 241 * @return a {@link Source source} representing the URI to which given URI was
resolved | |
| 242 */ | |
| 243 Source resolveRelative(Uri relativeUri); | |
| 244 } | |
| 245 /** | |
| 246 * The interface {@code ContentReceiver} defines the behavior of objects that ca
n receive the | |
| 247 * content of a source. | |
| 248 */ | |
| 249 abstract class Source_ContentReceiver { | |
| 250 /** | |
| 251 * Accept the contents of a source represented as a character buffer. | |
| 252 * @param contents the contents of the source | |
| 253 */ | |
| 254 accept(CharBuffer contents); | |
| 255 /** | |
| 256 * Accept the contents of a source represented as a string. | |
| 257 * @param contents the contents of the source | |
| 258 */ | |
| 259 void accept2(String contents); | |
| 260 } | |
| 261 /** | |
| 262 * The enumeration {@code SourceKind} defines the different kinds of sources tha
t are known to the | |
| 263 * analysis engine. | |
| 264 * @coverage dart.engine.source | |
| 265 */ | |
| 266 class SourceKind { | |
| 267 /** | |
| 268 * A source containing HTML. The HTML might or might not contain Dart scripts. | |
| 269 */ | |
| 270 static final SourceKind HTML = new SourceKind('HTML', 0); | |
| 271 /** | |
| 272 * A Dart compilation unit that is not a part of another library. Libraries mi
ght or might not | |
| 273 * contain any directives, including a library directive. | |
| 274 */ | |
| 275 static final SourceKind LIBRARY = new SourceKind('LIBRARY', 1); | |
| 276 /** | |
| 277 * A Dart compilation unit that is part of another library. Parts contain a pa
rt-of directive. | |
| 278 */ | |
| 279 static final SourceKind PART = new SourceKind('PART', 2); | |
| 280 /** | |
| 281 * An unknown kind of source. Used both when it is not possible to identify th
e kind of a source | |
| 282 * and also when the kind of a source is not known without performing a comput
ation and the client | |
| 283 * does not want to spend the time to identify the kind. | |
| 284 */ | |
| 285 static final SourceKind UNKNOWN = new SourceKind('UNKNOWN', 3); | |
| 286 static final List<SourceKind> values = [HTML, LIBRARY, PART, UNKNOWN]; | |
| 287 final String __name; | |
| 288 final int __ordinal; | |
| 289 int get ordinal => __ordinal; | |
| 290 SourceKind(this.__name, this.__ordinal) { | |
| 291 } | |
| 292 String toString() => __name; | |
| 293 } | |
| 294 /** | |
| 295 * A source range defines an {@link Element}'s source coordinates relative to it
s {@link Source}. | |
| 296 * @coverage dart.engine.utilities | |
| 297 */ | |
| 298 class SourceRange { | |
| 299 /** | |
| 300 * The 0-based index of the first character of the source code for this elemen
t, relative to the | |
| 301 * source buffer in which this element is contained. | |
| 302 */ | |
| 303 int _offset = 0; | |
| 304 /** | |
| 305 * The number of characters of the source code for this element, relative to t
he source buffer in | |
| 306 * which this element is contained. | |
| 307 */ | |
| 308 int _length = 0; | |
| 309 /** | |
| 310 * Initialize a newly created source range using the given offset and the give
n length. | |
| 311 * @param offset the given offset | |
| 312 * @param length the given length | |
| 313 */ | |
| 314 SourceRange(int offset, int length) { | |
| 315 this._offset = offset; | |
| 316 this._length = length; | |
| 317 } | |
| 318 /** | |
| 319 * @return <code>true</code> if <code>x</code> is in [offset, offset + length)
interval. | |
| 320 */ | |
| 321 bool contains(int x) => _offset <= x && x < _offset + _length; | |
| 322 /** | |
| 323 * @return <code>true</code> if <code>x</code> is in (offset, offset + length)
interval. | |
| 324 */ | |
| 325 bool containsExclusive(int x) => _offset < x && x < _offset + _length; | |
| 326 /** | |
| 327 * @return <code>true</code> if <code>otherRange</code> covers this {@link Sou
rceRange}. | |
| 328 */ | |
| 329 bool coveredBy(SourceRange otherRange) => otherRange.covers(this); | |
| 330 /** | |
| 331 * @return <code>true</code> if this {@link SourceRange} covers <code>otherRan
ge</code>. | |
| 332 */ | |
| 333 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; | |
| 334 /** | |
| 335 * @return <code>true</code> if this {@link SourceRange} ends in <code>otherRa
nge</code>. | |
| 336 */ | |
| 337 bool endsIn(SourceRange otherRange) { | |
| 338 int thisEnd = end; | |
| 339 return otherRange.contains(thisEnd); | |
| 340 } | |
| 341 bool operator ==(Object obj) { | |
| 342 if (obj is! SourceRange) { | |
| 343 return false; | |
| 344 } | |
| 345 SourceRange sourceRange = obj as SourceRange; | |
| 346 return sourceRange.offset == _offset && sourceRange.length == _length; | |
| 347 } | |
| 348 /** | |
| 349 * @return the 0-based index of the after-last character of the source code fo
r this element, | |
| 350 * relative to the source buffer in which this element is contained. | |
| 351 */ | |
| 352 int get end => _offset + _length; | |
| 353 /** | |
| 354 * @return the expanded instance of {@link SourceRange}, which has the same ce
nter. | |
| 355 */ | |
| 356 SourceRange getExpanded(int delta) => new SourceRange(_offset - delta, delta +
_length + delta); | |
| 357 /** | |
| 358 * Returns the number of characters of the source code for this element, relat
ive to the source | |
| 359 * buffer in which this element is contained. | |
| 360 * @return the number of characters of the source code for this element, relat
ive to the source | |
| 361 * buffer in which this element is contained | |
| 362 */ | |
| 363 int get length => _length; | |
| 364 /** | |
| 365 * @return the instance of {@link SourceRange} with end moved on "delta". | |
| 366 */ | |
| 367 SourceRange getMoveEnd(int delta) => new SourceRange(_offset, _length + delta)
; | |
| 368 /** | |
| 369 * Returns the 0-based index of the first character of the source code for thi
s element, relative | |
| 370 * to the source buffer in which this element is contained. | |
| 371 * @return the 0-based index of the first character of the source code for thi
s element, relative | |
| 372 * to the source buffer in which this element is contained | |
| 373 */ | |
| 374 int get offset => _offset; | |
| 375 int get hashCode => 31 * _offset + _length; | |
| 376 /** | |
| 377 * @return <code>true</code> if this {@link SourceRange} intersects with given
. | |
| 378 */ | |
| 379 bool intersects(SourceRange other) { | |
| 380 if (other == null) { | |
| 381 return false; | |
| 382 } | |
| 383 if (end <= other.offset) { | |
| 384 return false; | |
| 385 } | |
| 386 if (offset >= other.end) { | |
| 387 return false; | |
| 388 } | |
| 389 return true; | |
| 390 } | |
| 391 /** | |
| 392 * @return <code>true</code> if this {@link SourceRange} starts in <code>other
Range</code>. | |
| 393 */ | |
| 394 bool startsIn(SourceRange otherRange) => otherRange.contains(_offset); | |
| 395 String toString() { | |
| 396 JavaStringBuilder builder = new JavaStringBuilder(); | |
| 397 builder.append("[offset="); | |
| 398 builder.append(_offset); | |
| 399 builder.append(", length="); | |
| 400 builder.append(_length); | |
| 401 builder.append("]"); | |
| 402 return builder.toString(); | |
| 403 } | |
| 404 } | |
| 405 /** | |
| 406 * The interface {@code SourceContainer} is used by clients to define a collecti
on of sources | |
| 407 * <p> | |
| 408 * Source containers are not used within analysis engine, but can be used by cli
ents to group | |
| 409 * sources for the purposes of accessing composite dependency information. For e
xample, the Eclipse | |
| 410 * client uses source containers to represent Eclipse projects, which allows it
to easily compute | |
| 411 * project-level dependencies. | |
| 412 * @coverage dart.engine.source | |
| 413 */ | |
| 414 abstract class SourceContainer { | |
| 415 /** | |
| 416 * Determine if the specified source is part of the receiver's collection of s
ources. | |
| 417 * @param source the source in question | |
| 418 * @return {@code true} if the receiver contains the source, else {@code false
} | |
| 419 */ | |
| 420 bool contains(Source source); | |
| 421 } | |
| 422 /** | |
| 423 * Instances of the class {@code LineInfo} encapsulate information about line an
d column information | |
| 424 * within a source file. | |
| 425 * @coverage dart.engine.utilities | |
| 426 */ | |
| 427 class LineInfo { | |
| 428 /** | |
| 429 * An array containing the offsets of the first character of each line in the
source code. | |
| 430 */ | |
| 431 List<int> _lineStarts; | |
| 432 /** | |
| 433 * Initialize a newly created set of line information to represent the data en
coded in the given | |
| 434 * array. | |
| 435 * @param lineStarts the offsets of the first character of each line in the so
urce code | |
| 436 */ | |
| 437 LineInfo(List<int> lineStarts) { | |
| 438 if (lineStarts == null) { | |
| 439 throw new IllegalArgumentException("lineStarts must be non-null"); | |
| 440 } else if (lineStarts.length < 1) { | |
| 441 throw new IllegalArgumentException("lineStarts must be non-empty"); | |
| 442 } | |
| 443 this._lineStarts = lineStarts; | |
| 444 } | |
| 445 /** | |
| 446 * Return the location information for the character at the given offset. | |
| 447 * @param offset the offset of the character for which location information is
to be returned | |
| 448 * @return the location information for the character at the given offset | |
| 449 */ | |
| 450 LineInfo_Location getLocation(int offset) { | |
| 451 int lineCount = _lineStarts.length; | |
| 452 for (int i = 1; i < lineCount; i++) { | |
| 453 if (offset < _lineStarts[i]) { | |
| 454 return new LineInfo_Location(i, offset - _lineStarts[i - 1] + 1); | |
| 455 } | |
| 456 } | |
| 457 return new LineInfo_Location(lineCount, offset - _lineStarts[lineCount - 1]
+ 1); | |
| 458 } | |
| 459 } | |
| 460 /** | |
| 461 * Instances of the class {@code Location} represent the location of a character
as a line and | |
| 462 * column pair. | |
| 463 */ | |
| 464 class LineInfo_Location { | |
| 465 /** | |
| 466 * The one-based index of the line containing the character. | |
| 467 */ | |
| 468 int _lineNumber = 0; | |
| 469 /** | |
| 470 * The one-based index of the column containing the character. | |
| 471 */ | |
| 472 int _columnNumber = 0; | |
| 473 /** | |
| 474 * Initialize a newly created location to represent the location of the charac
ter at the given | |
| 475 * line and column position. | |
| 476 * @param lineNumber the one-based index of the line containing the character | |
| 477 * @param columnNumber the one-based index of the column containing the charac
ter | |
| 478 */ | |
| 479 LineInfo_Location(int lineNumber, int columnNumber) { | |
| 480 this._lineNumber = lineNumber; | |
| 481 this._columnNumber = columnNumber; | |
| 482 } | |
| 483 /** | |
| 484 * Return the one-based index of the column containing the character. | |
| 485 * @return the one-based index of the column containing the character | |
| 486 */ | |
| 487 int get columnNumber => _columnNumber; | |
| 488 /** | |
| 489 * Return the one-based index of the line containing the character. | |
| 490 * @return the one-based index of the line containing the character | |
| 491 */ | |
| 492 int get lineNumber => _lineNumber; | |
| 493 } | |
| 494 /** | |
| 495 * Instances of class {@code ContentCache} hold content used to override the def
ault content of a{@link Source}. | |
| 496 * @coverage dart.engine.source | |
| 497 */ | |
| 498 class ContentCache { | |
| 499 /** | |
| 500 * A table mapping sources to the contents of those sources. This is used to o
verride the default | |
| 501 * contents of a source. | |
| 502 */ | |
| 503 Map<Source, String> _contentMap = new Map<Source, String>(); | |
| 504 /** | |
| 505 * A table mapping sources to the modification stamps of those sources. This i
s used when the | |
| 506 * default contents of a source has been overridden. | |
| 507 */ | |
| 508 Map<Source, int> _stampMap = new Map<Source, int>(); | |
| 509 /** | |
| 510 * Initialize a newly created cache to be empty. | |
| 511 */ | |
| 512 ContentCache() : super() { | |
| 513 } | |
| 514 /** | |
| 515 * Return the contents of the given source, or {@code null} if this cache does
not override the | |
| 516 * contents of the source. | |
| 517 * <p> | |
| 518 * <b>Note:</b> This method is not intended to be used except by{@link SourceF
actory#getContents(com.google.dart.engine.source.Source.ContentReceiver)}. | |
| 519 * @param source the source whose content is to be returned | |
| 520 * @return the contents of the given source | |
| 521 */ | |
| 522 String getContents(Source source) => _contentMap[source]; | |
| 523 /** | |
| 524 * Return the modification stamp of the given source, or {@code null} if this
cache does not | |
| 525 * override the contents of the source. | |
| 526 * <p> | |
| 527 * <b>Note:</b> This method is not intended to be used except by{@link SourceF
actory#getModificationStamp(com.google.dart.engine.source.Source)}. | |
| 528 * @param source the source whose modification stamp is to be returned | |
| 529 * @return the modification stamp of the given source | |
| 530 */ | |
| 531 int getModificationStamp(Source source) => _stampMap[source]; | |
| 532 /** | |
| 533 * Set the contents of the given source to the given contents. This has the ef
fect of overriding | |
| 534 * the default contents of the source. If the contents are {@code null} the ov
erride is removed so | |
| 535 * that the default contents will be returned. | |
| 536 * @param source the source whose contents are being overridden | |
| 537 * @param contents the new contents of the source | |
| 538 */ | |
| 539 void setContents(Source source, String contents) { | |
| 540 if (contents == null) { | |
| 541 _contentMap.remove(source); | |
| 542 _stampMap.remove(source); | |
| 543 } else { | |
| 544 _contentMap[source] = contents; | |
| 545 _stampMap[source] = JavaSystem.currentTimeMillis(); | |
| 546 } | |
| 547 } | |
| 548 } | |
| OLD | NEW |