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

Unified Diff: pkg/analyzer_experimental/lib/src/generated/source_io.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_io.dart
diff --git a/pkg/analyzer_experimental/lib/src/generated/source_io.dart b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
index c2277eba896798d12b082c25485883dc2c141cc0..e31849406a7ba48e46a9f051e5ac53b6e3e1faf8 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
@@ -56,7 +56,14 @@ class FileBasedSource implements Source {
this._contentCache = contentCache;
this._file = file;
this._uriKind = uriKind;
- this._encoding = "${uriKind.encoding}${file.toURI().toString()}";
+ if (file.getPath().indexOf(':') > 2) {
+ try {
+ throw new IllegalArgumentException("Invalid source path: ${file}");
+ } on IllegalArgumentException catch (e) {
+ AnalysisEngine.instance.logger.logError3(e);
+ throw e;
+ }
+ }
}
bool operator ==(Object object) => object != null && this.runtimeType == object.runtimeType && _file == ((object as FileBasedSource))._file;
bool exists() => _contentCache.getContents(this) != null || (_file.exists() && !_file.isDirectory());
@@ -70,7 +77,12 @@ class FileBasedSource implements Source {
}
receiver.accept2(_file.readAsStringSync(), _file.lastModified());
}
- String get encoding => _encoding;
+ String get encoding {
+ if (_encoding == null) {
+ _encoding = "${_uriKind.encoding}${_file.toURI().toString()}";
+ }
+ return _encoding;
+ }
String get fullName => _file.getAbsolutePath();
int get modificationStamp {
int stamp = _contentCache.getModificationStamp(this);

Powered by Google App Engine
This is Rietveld 408576698