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

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

Issue 23769004: java2dart improvement - use field if getter/setter are trivial. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 fd374b50ad446cff794084d9bd778fd2ce60b7d1..76bfcd2a6262df1420429c157c3f6e332d05681c 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
@@ -22,7 +22,7 @@ class FileBasedSource implements Source {
/**
* The file represented by this source.
*/
- JavaFile _file;
+ JavaFile file;
/**
* The cached encoding for this source.
@@ -52,7 +52,7 @@ class FileBasedSource implements Source {
*/
FileBasedSource.con2(ContentCache contentCache, JavaFile file, UriKind uriKind) {
this._contentCache = contentCache;
- this._file = file;
+ this.file = file;
this._uriKind = uriKind;
if (file.getPath().indexOf(':') > 2) {
try {
@@ -63,8 +63,8 @@ class FileBasedSource implements Source {
}
}
}
- 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());
+ 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());
void getContents(Source_ContentReceiver receiver) {
{
String contents = _contentCache.getContents(this);
@@ -73,25 +73,25 @@ class FileBasedSource implements Source {
return;
}
}
- receiver.accept2(_file.readAsStringSync(), _file.lastModified());
+ receiver.accept2(file.readAsStringSync(), file.lastModified());
}
String get encoding {
if (_encoding == null) {
- _encoding = "${_uriKind.encoding}${_file.toURI().toString()}";
+ _encoding = "${_uriKind.encoding}${file.toURI().toString()}";
}
return _encoding;
}
- String get fullName => _file.getAbsolutePath();
+ String get fullName => file.getAbsolutePath();
int get modificationStamp {
int stamp = _contentCache.getModificationStamp(this);
if (stamp != null) {
return stamp;
}
- return _file.lastModified();
+ return file.lastModified();
}
- String get shortName => _file.getName();
+ String get shortName => file.getName();
UriKind get uriKind => _uriKind;
- int get hashCode => _file.hashCode;
+ int get hashCode => file.hashCode;
bool get isInSystemLibrary => identical(_uriKind, UriKind.DART_URI);
Source resolveRelative(Uri containedUri) {
try {
@@ -102,19 +102,11 @@ class FileBasedSource implements Source {
return null;
}
String toString() {
- if (_file == null) {
+ if (file == null) {
return "<unknown source>";
}
- return _file.getAbsolutePath();
+ return file.getAbsolutePath();
}
-
- /**
- * Return the file represented by this source. This is an internal method that is only intended to
- * be used by [UriResolver].
- *
- * @return the file represented by this source
- */
- JavaFile get file => _file;
}
/**
* Instances of the class `PackageUriResolver` resolve `package` URI's in the context of
@@ -272,7 +264,7 @@ class DirectoryBasedSourceContainer implements SourceContainer {
/**
* The container's path (not `null`).
*/
- String _path;
+ String path;
/**
* Construct a container representing the specified directory and containing any sources whose
@@ -291,19 +283,12 @@ class DirectoryBasedSourceContainer implements SourceContainer {
* @param path the path (not `null` and not empty)
*/
DirectoryBasedSourceContainer.con2(String path) {
- this._path = appendFileSeparator(path);
+ this.path = appendFileSeparator(path);
}
- bool contains(Source source) => source.fullName.startsWith(_path);
+ bool contains(Source source) => source.fullName.startsWith(path);
bool operator ==(Object obj) => (obj is DirectoryBasedSourceContainer) && ((obj as DirectoryBasedSourceContainer)).path == path;
-
- /**
- * Answer the receiver's path, used to determine if a source is contained in the receiver.
- *
- * @return the path (not `null`, not empty)
- */
- String get path => _path;
- int get hashCode => _path.hashCode;
- String toString() => "SourceContainer[${_path}]";
+ int get hashCode => path.hashCode;
+ String toString() => "SourceContainer[${path}]";
}
/**
* Instances of the class `FileUriResolver` resolve `file` URI's.

Powered by Google App Engine
This is Rietveld 408576698