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

Unified Diff: pkg/analyzer_experimental/lib/src/generated/source.dart

Issue 22285004: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer_experimental/lib/src/generated/source.dart
diff --git a/pkg/analyzer_experimental/lib/src/generated/source.dart b/pkg/analyzer_experimental/lib/src/generated/source.dart
index e6463ff9743a03414ac82fcd1d6e691d53409a33..cf901a32e0b98e4018de5d880ad038b060242ef5 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source.dart
@@ -135,6 +135,9 @@ class SourceFactory {
* @return the source representing the contained URI
*/
Source resolveUri(Source containingSource, String containedUri) {
+ if (containedUri == null) {
+ return null;
+ }
try {
return resolveUri2(containingSource, parseUriWithException(containedUri));
} on URISyntaxException catch (exception) {
@@ -165,10 +168,9 @@ class SourceFactory {
*
* @param source the source whose contents are being overridden
* @param contents the new contents of the source
+ * @return `true` if the new cached contents are different from the old, else `false`
*/
- void setContents(Source source, String contents) {
- _contentCache.setContents(source, contents);
- }
+ bool setContents(Source source, String contents) => _contentCache.setContents(source, contents);
/**
* Set the analysis context that this source factory is associated with to the given context.
@@ -420,7 +422,7 @@ abstract class Source_ContentReceiver {
*
* @coverage dart.engine.source
*/
-class SourceKind implements Comparable<SourceKind> {
+class SourceKind implements Enum<SourceKind> {
/**
* A source containing HTML. The HTML might or might not contain Dart scripts.
@@ -462,7 +464,7 @@ class SourceKind implements Comparable<SourceKind> {
*
* @coverage dart.engine.source
*/
-class UriKind implements Comparable<UriKind> {
+class UriKind implements Enum<UriKind> {
/**
* A 'dart:' URI.
@@ -877,14 +879,16 @@ class ContentCache {
*
* @param source the source whose contents are being overridden
* @param contents the new contents of the source
+ * @return `true` if the new cached contents are different than the old, else `false`
*/
- void setContents(Source source, String contents) {
+ bool setContents(Source source, String contents) {
if (contents == null) {
- _contentMap.remove(source);
_stampMap.remove(source);
+ return _contentMap.remove(source) != null;
} else {
- _contentMap[source] = contents;
_stampMap[source] = JavaSystem.currentTimeMillis();
+ String originalContents = javaMapPut(_contentMap, source, contents);
+ return contents != originalContents;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698