| 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 `SourceFactory` resolve possibly relative URI's agains
t an existing | 8 * Instances of the class `SourceFactory` resolve possibly relative URI's agains
t an existing |
| 9 * [Source]. | 9 * [Source]. |
| 10 * | 10 * |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 * Return a source object representing the URI that results from resolving the
given (possibly | 128 * Return a source object representing the URI that results from resolving the
given (possibly |
| 129 * relative) contained URI against the URI associated with an existing source
object, or | 129 * relative) contained URI against the URI associated with an existing source
object, or |
| 130 * `null` if either the contained URI is invalid or if it cannot be resolved a
gainst the | 130 * `null` if either the contained URI is invalid or if it cannot be resolved a
gainst the |
| 131 * source object's URI. | 131 * source object's URI. |
| 132 * | 132 * |
| 133 * @param containingSource the source containing the given URI | 133 * @param containingSource the source containing the given URI |
| 134 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 134 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
| 135 * @return the source representing the contained URI | 135 * @return the source representing the contained URI |
| 136 */ | 136 */ |
| 137 Source resolveUri(Source containingSource, String containedUri) { | 137 Source resolveUri(Source containingSource, String containedUri) { |
| 138 if (containedUri == null) { |
| 139 return null; |
| 140 } |
| 138 try { | 141 try { |
| 139 return resolveUri2(containingSource, parseUriWithException(containedUri)); | 142 return resolveUri2(containingSource, parseUriWithException(containedUri)); |
| 140 } on URISyntaxException catch (exception) { | 143 } on URISyntaxException catch (exception) { |
| 141 return null; | 144 return null; |
| 142 } | 145 } |
| 143 } | 146 } |
| 144 | 147 |
| 145 /** | 148 /** |
| 146 * Return an absolute URI that represents the given source. | 149 * Return an absolute URI that represents the given source. |
| 147 * | 150 * |
| (...skipping 10 matching lines...) Expand all Loading... |
| 158 return null; | 161 return null; |
| 159 } | 162 } |
| 160 | 163 |
| 161 /** | 164 /** |
| 162 * Set the contents of the given source to the given contents. This has the ef
fect of overriding | 165 * Set the contents of the given source to the given contents. This has the ef
fect of overriding |
| 163 * the default contents of the source. If the contents are `null` the override
is removed so | 166 * the default contents of the source. If the contents are `null` the override
is removed so |
| 164 * that the default contents will be returned. | 167 * that the default contents will be returned. |
| 165 * | 168 * |
| 166 * @param source the source whose contents are being overridden | 169 * @param source the source whose contents are being overridden |
| 167 * @param contents the new contents of the source | 170 * @param contents the new contents of the source |
| 171 * @return `true` if the new cached contents are different from the old, else
`false` |
| 168 */ | 172 */ |
| 169 void setContents(Source source, String contents) { | 173 bool setContents(Source source, String contents) => _contentCache.setContents(
source, contents); |
| 170 _contentCache.setContents(source, contents); | |
| 171 } | |
| 172 | 174 |
| 173 /** | 175 /** |
| 174 * Set the analysis context that this source factory is associated with to the
given context. | 176 * Set the analysis context that this source factory is associated with to the
given context. |
| 175 * | 177 * |
| 176 * <b>Note:</b> This method should only be invoked by | 178 * <b>Note:</b> This method should only be invoked by |
| 177 * [AnalysisContextImpl#setSourceFactory] and is only public out of | 179 * [AnalysisContextImpl#setSourceFactory] and is only public out of |
| 178 * necessity. | 180 * necessity. |
| 179 * | 181 * |
| 180 * @param context the analysis context that this source factory is associated
with | 182 * @param context the analysis context that this source factory is associated
with |
| 181 */ | 183 */ |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 * @param modificationTime the time at which the contents were last set | 415 * @param modificationTime the time at which the contents were last set |
| 414 */ | 416 */ |
| 415 void accept2(String contents, int modificationTime); | 417 void accept2(String contents, int modificationTime); |
| 416 } | 418 } |
| 417 /** | 419 /** |
| 418 * The enumeration `SourceKind` defines the different kinds of sources that are
known to the | 420 * The enumeration `SourceKind` defines the different kinds of sources that are
known to the |
| 419 * analysis engine. | 421 * analysis engine. |
| 420 * | 422 * |
| 421 * @coverage dart.engine.source | 423 * @coverage dart.engine.source |
| 422 */ | 424 */ |
| 423 class SourceKind implements Comparable<SourceKind> { | 425 class SourceKind implements Enum<SourceKind> { |
| 424 | 426 |
| 425 /** | 427 /** |
| 426 * A source containing HTML. The HTML might or might not contain Dart scripts. | 428 * A source containing HTML. The HTML might or might not contain Dart scripts. |
| 427 */ | 429 */ |
| 428 static final SourceKind HTML = new SourceKind('HTML', 0); | 430 static final SourceKind HTML = new SourceKind('HTML', 0); |
| 429 | 431 |
| 430 /** | 432 /** |
| 431 * A Dart compilation unit that is not a part of another library. Libraries mi
ght or might not | 433 * A Dart compilation unit that is not a part of another library. Libraries mi
ght or might not |
| 432 * contain any directives, including a library directive. | 434 * contain any directives, including a library directive. |
| 433 */ | 435 */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 455 int compareTo(SourceKind other) => ordinal - other.ordinal; | 457 int compareTo(SourceKind other) => ordinal - other.ordinal; |
| 456 int get hashCode => ordinal; | 458 int get hashCode => ordinal; |
| 457 String toString() => name; | 459 String toString() => name; |
| 458 } | 460 } |
| 459 /** | 461 /** |
| 460 * The enumeration `UriKind` defines the different kinds of URI's that are known
to the | 462 * The enumeration `UriKind` defines the different kinds of URI's that are known
to the |
| 461 * analysis engine. These are used to keep track of the kind of URI associated w
ith a given source. | 463 * analysis engine. These are used to keep track of the kind of URI associated w
ith a given source. |
| 462 * | 464 * |
| 463 * @coverage dart.engine.source | 465 * @coverage dart.engine.source |
| 464 */ | 466 */ |
| 465 class UriKind implements Comparable<UriKind> { | 467 class UriKind implements Enum<UriKind> { |
| 466 | 468 |
| 467 /** | 469 /** |
| 468 * A 'dart:' URI. | 470 * A 'dart:' URI. |
| 469 */ | 471 */ |
| 470 static final UriKind DART_URI = new UriKind('DART_URI', 0, 0x64); | 472 static final UriKind DART_URI = new UriKind('DART_URI', 0, 0x64); |
| 471 | 473 |
| 472 /** | 474 /** |
| 473 * A 'file:' URI. | 475 * A 'file:' URI. |
| 474 */ | 476 */ |
| 475 static final UriKind FILE_URI = new UriKind('FILE_URI', 1, 0x66); | 477 static final UriKind FILE_URI = new UriKind('FILE_URI', 1, 0x66); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 */ | 872 */ |
| 871 int getModificationStamp(Source source) => _stampMap[source]; | 873 int getModificationStamp(Source source) => _stampMap[source]; |
| 872 | 874 |
| 873 /** | 875 /** |
| 874 * Set the contents of the given source to the given contents. This has the ef
fect of overriding | 876 * Set the contents of the given source to the given contents. This has the ef
fect of overriding |
| 875 * the default contents of the source. If the contents are `null` the override
is removed so | 877 * the default contents of the source. If the contents are `null` the override
is removed so |
| 876 * that the default contents will be returned. | 878 * that the default contents will be returned. |
| 877 * | 879 * |
| 878 * @param source the source whose contents are being overridden | 880 * @param source the source whose contents are being overridden |
| 879 * @param contents the new contents of the source | 881 * @param contents the new contents of the source |
| 882 * @return `true` if the new cached contents are different than the old, else
`false` |
| 880 */ | 883 */ |
| 881 void setContents(Source source, String contents) { | 884 bool setContents(Source source, String contents) { |
| 882 if (contents == null) { | 885 if (contents == null) { |
| 883 _contentMap.remove(source); | |
| 884 _stampMap.remove(source); | 886 _stampMap.remove(source); |
| 887 return _contentMap.remove(source) != null; |
| 885 } else { | 888 } else { |
| 886 _contentMap[source] = contents; | |
| 887 _stampMap[source] = JavaSystem.currentTimeMillis(); | 889 _stampMap[source] = JavaSystem.currentTimeMillis(); |
| 890 String originalContents = javaMapPut(_contentMap, source, contents); |
| 891 return contents != originalContents; |
| 888 } | 892 } |
| 889 } | 893 } |
| 890 } | 894 } |
| OLD | NEW |