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

Unified Diff: pkg/analyzer/lib/src/generated/source_io.dart

Issue 1131423002: Clean up many generated constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment change Created 5 years, 7 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/lib/src/generated/source_io.dart
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index e885cd8fdddf92d32dfcfaa8fb718ce795f2d10f..1c60f5d19a5778b6f3ee59254b09ff2a8b0802d7 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -128,11 +128,24 @@ class FileBasedSource extends Source {
String _encoding;
/**
+ * Initialize a newly created source object to represent the given [file]. If
+ * a [uri] is given, then it will be used as the URI from which the source was
+ * derived, otherwise a `file:` URI will be created based on the [file].
+ */
+ FileBasedSource(JavaFile file, [Uri uri])
+ : this.uri = (uri == null ? file.toURI() : uri),
+ this.file = file,
+ id = _idTable.putIfAbsent(
+ '${uri == null ? file.toURI() : uri}@${file.getPath()}',
+ () => _idTable.length);
+
+ /**
* Initialize a newly created source object.
*
* @param file the file represented by this source
*/
- FileBasedSource.con1(JavaFile file) : this.con2(file.toURI(), file);
+ @deprecated // Use new FileBasedSource(file)
+ FileBasedSource.con1(JavaFile file) : this(file);
/**
* Initialize a newly created source object.
@@ -140,6 +153,7 @@ class FileBasedSource extends Source {
* @param file the file represented by this source
* @param uri the URI from which this source was originally derived
*/
+ @deprecated // Use new FileBasedSource(file, uri)
FileBasedSource.con2(Uri uri, JavaFile file)
: uri = uri,
file = file,
@@ -266,7 +280,7 @@ class FileUriResolver extends UriResolver {
if (!isFileUri(uri)) {
return null;
}
- return new FileBasedSource.con2(uri, new JavaFile.fromUri(uri));
+ return new FileBasedSource(new JavaFile.fromUri(uri), uri);
}
/**
@@ -437,11 +451,11 @@ class PackageUriResolver extends UriResolver {
if (_isSelfReference(packagesDirectory, canonicalFile)) {
uri = canonicalFile.toURI();
}
- return new FileBasedSource.con2(uri, canonicalFile);
+ return new FileBasedSource(canonicalFile, uri);
}
}
- return new FileBasedSource.con2(
- uri, getCanonicalFile(_packagesDirectories[0], pkgName, relPath));
+ return new FileBasedSource(
+ getCanonicalFile(_packagesDirectories[0], pkgName, relPath), uri);
}
@override
@@ -523,7 +537,7 @@ class RelativeFileUriResolver extends UriResolver {
for (JavaFile dir in _relativeDirectories) {
JavaFile file = new JavaFile.relative(dir, filePath);
if (file.exists()) {
- return new FileBasedSource.con2(uri, file);
+ return new FileBasedSource(file, uri);
}
}
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/source.dart ('k') | pkg/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698