| 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 9ff2b5c659b8894d184a4de1b3502118d0d74a7c..711d7fe255b475e64bb69d090b295a20ee43f670 100644
|
| --- a/pkg/analyzer/lib/src/generated/source_io.dart
|
| +++ b/pkg/analyzer/lib/src/generated/source_io.dart
|
| @@ -66,7 +66,7 @@ class FileBasedSource implements Source {
|
| /**
|
| * The file represented by this source.
|
| */
|
| - final JavaFile file;
|
| + JavaFile _file;
|
|
|
| /**
|
| * The cached encoding for this source.
|
| @@ -76,7 +76,7 @@ class FileBasedSource implements Source {
|
| /**
|
| * The kind of URI from which this source was originally derived.
|
| */
|
| - final UriKind uriKind;
|
| + UriKind _uriKind;
|
|
|
| /**
|
| * Initialize a newly created source object. The source object is assumed to not be in a system
|
| @@ -92,13 +92,16 @@ class FileBasedSource implements Source {
|
| * @param file the file represented by this source
|
| * @param flags `true` if this source is in one of the system libraries
|
| */
|
| - FileBasedSource.con2(this.file, this.uriKind);
|
| + FileBasedSource.con2(JavaFile file, UriKind uriKind) {
|
| + this._file = file;
|
| + this._uriKind = uriKind;
|
| + }
|
|
|
| @override
|
| - bool operator ==(Object object) => object != null && this.runtimeType == object.runtimeType && file == (object as FileBasedSource).file;
|
| + bool operator ==(Object object) => object != null && this.runtimeType == object.runtimeType && _file == (object as FileBasedSource)._file;
|
|
|
| @override
|
| - bool exists() => file.isFile();
|
| + bool exists() => _file.isFile();
|
|
|
| @override
|
| TimestampedData<String> get contents {
|
| @@ -113,31 +116,34 @@ class FileBasedSource implements Source {
|
| @override
|
| String get encoding {
|
| if (_encoding == null) {
|
| - _encoding = "${uriKind.encoding}${file.toURI().toString()}";
|
| + _encoding = "${_uriKind.encoding}${_file.toURI().toString()}";
|
| }
|
| return _encoding;
|
| }
|
|
|
| @override
|
| - String get fullName => file.getAbsolutePath();
|
| + String get fullName => _file.getAbsolutePath();
|
| +
|
| + @override
|
| + int get modificationStamp => _file.lastModified();
|
|
|
| @override
|
| - int get modificationStamp => file.lastModified();
|
| + String get shortName => _file.getName();
|
|
|
| @override
|
| - String get shortName => file.getName();
|
| + UriKind get uriKind => _uriKind;
|
|
|
| @override
|
| - int get hashCode => file.hashCode;
|
| + int get hashCode => _file.hashCode;
|
|
|
| @override
|
| - bool get isInSystemLibrary => identical(uriKind, UriKind.DART_URI);
|
| + bool get isInSystemLibrary => identical(_uriKind, UriKind.DART_URI);
|
|
|
| @override
|
| Source resolveRelative(Uri containedUri) {
|
| try {
|
| Uri resolvedUri = file.toURI().resolveUri(containedUri);
|
| - return new FileBasedSource.con2(new JavaFile.fromUri(resolvedUri), uriKind);
|
| + return new FileBasedSource.con2(new JavaFile.fromUri(resolvedUri), _uriKind);
|
| } on JavaException catch (exception) {
|
| }
|
| return null;
|
| @@ -145,10 +151,10 @@ class FileBasedSource implements Source {
|
|
|
| @override
|
| String toString() {
|
| - if (file == null) {
|
| + if (_file == null) {
|
| return "<unknown source>";
|
| }
|
| - return file.getAbsolutePath();
|
| + return _file.getAbsolutePath();
|
| }
|
|
|
| /**
|
| @@ -163,8 +169,16 @@ class FileBasedSource implements Source {
|
| * @see #getContents()
|
| */
|
| TimestampedData<String> get contentsFromFile {
|
| - return new TimestampedData<String>(file.lastModified(), file.readAsStringSync());
|
| + return new TimestampedData<String>(_file.lastModified(), _file.readAsStringSync());
|
| }
|
| +
|
| + /**
|
| + * Return the file represented by this source. This is an internal method that is only intended to
|
| + * be used by subclasses of [UriResolver] that are designed to work with file-based sources.
|
| + *
|
| + * @return the file represented by this source
|
| + */
|
| + JavaFile get file => _file;
|
| }
|
|
|
| /**
|
| @@ -179,7 +193,7 @@ class PackageUriResolver extends UriResolver {
|
| /**
|
| * The package directories that `package` URI's are assumed to be relative to.
|
| */
|
| - final List<JavaFile> _packagesDirectories;
|
| + List<JavaFile> _packagesDirectories;
|
|
|
| /**
|
| * The name of the `package` scheme.
|
| @@ -206,10 +220,11 @@ class PackageUriResolver extends UriResolver {
|
| * @param packagesDirectories the package directories that `package` URI's are assumed to be
|
| * relative to
|
| */
|
| - PackageUriResolver(this._packagesDirectories) {
|
| - if (_packagesDirectories.length < 1) {
|
| + PackageUriResolver(List<JavaFile> packagesDirectories) {
|
| + if (packagesDirectories.length < 1) {
|
| throw new IllegalArgumentException("At least one package directory must be provided");
|
| }
|
| + this._packagesDirectories = packagesDirectories;
|
| }
|
|
|
| @override
|
|
|