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

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

Issue 725143004: Format and sort analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/java_engine.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/java_io.dart
diff --git a/pkg/analyzer/lib/src/generated/java_io.dart b/pkg/analyzer/lib/src/generated/java_io.dart
index 66e38d7bd81430141dc66e60a753a33cb1c95d7c..5e900d1ce69b6890104788008f9546d2112d6af8 100644
--- a/pkg/analyzer/lib/src/generated/java_io.dart
+++ b/pkg/analyzer/lib/src/generated/java_io.dart
@@ -1,55 +1,10 @@
library java.io;
import "dart:io";
-import 'java_core.dart' show JavaIOException;
+
import 'package:path/path.dart' as pathos;
-class JavaSystemIO {
- static Map<String, String> _properties = new Map();
- static String getProperty(String name) {
- {
- String value = _properties[name];
- if (value != null) {
- return value;
- }
- }
- if (name == 'os.name') {
- return Platform.operatingSystem;
- }
- if (name == 'line.separator') {
- if (Platform.isWindows) {
- return '\r\n';
- }
- return '\n';
- }
- if (name == 'com.google.dart.sdk') {
- String exec = Platform.executable;
- if (exec.length != 0) {
- String sdkPath;
- // may be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling
- {
- var outDir = pathos.dirname(pathos.dirname(exec));
- sdkPath = pathos.join(pathos.dirname(outDir), "sdk");
- if (new Directory(sdkPath).existsSync()) {
- _properties[name] = sdkPath;
- return sdkPath;
- }
- }
- // probably be "dart-sdk/bin/dart"
- sdkPath = pathos.dirname(pathos.dirname(exec));
- _properties[name] = sdkPath;
- return sdkPath;
- }
- }
- return null;
- }
- static String setProperty(String name, String value) {
- String oldValue = _properties[name];
- _properties[name] = value;
- return oldValue;
- }
- static String getenv(String name) => Platform.environment[name];
-}
+import 'java_core.dart' show JavaIOException;
class JavaFile {
static final String separator = Platform.pathSeparator;
@@ -58,6 +13,7 @@ class JavaFile {
JavaFile(String path) {
_path = path;
}
+ JavaFile.fromUri(Uri uri) : this(pathos.fromUri(uri));
JavaFile.relative(JavaFile base, String child) {
if (child.isEmpty) {
this._path = base._path;
@@ -65,30 +21,26 @@ class JavaFile {
this._path = pathos.join(base._path, child);
}
}
- JavaFile.fromUri(Uri uri) : this(pathos.fromUri(uri));
- String toString() => _path.toString();
int get hashCode => _path.hashCode;
bool operator ==(other) {
return other is JavaFile && other._path == _path;
}
- String getPath() => _path;
- String getName() => pathos.basename(_path);
- String getParent() {
- var result = pathos.dirname(_path);
- // "." or "/" or "C:\"
- if (result.length < 4) return null;
- return result;
- }
- JavaFile getParentFile() {
- var parent = getParent();
- if (parent == null) return null;
- return new JavaFile(parent);
+ bool exists() {
+ if (_newFile().existsSync()) {
+ return true;
+ }
+ if (_newDirectory().existsSync()) {
+ return true;
+ }
+ return false;
}
+ JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath());
String getAbsolutePath() {
String path = pathos.absolute(_path);
path = pathos.normalize(path);
return path;
}
+ JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath());
String getCanonicalPath() {
try {
return _newFile().resolveSymbolicLinksSync();
@@ -96,16 +48,21 @@ class JavaFile {
throw new JavaIOException('IOException', e);
}
}
- JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath());
- JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath());
- bool exists() {
- if (_newFile().existsSync()) {
- return true;
- }
- if (_newDirectory().existsSync()) {
- return true;
- }
- return false;
+ String getName() => pathos.basename(_path);
+ String getParent() {
+ var result = pathos.dirname(_path);
+ // "." or "/" or "C:\"
+ if (result.length < 4) return null;
+ return result;
+ }
+ JavaFile getParentFile() {
+ var parent = getParent();
+ if (parent == null) return null;
+ return new JavaFile(parent);
+ }
+ String getPath() => _path;
+ bool isDirectory() {
+ return _newDirectory().existsSync();
}
bool isExecutable() {
return _newFile().statSync().mode & 0x111 != 0;
@@ -113,14 +70,6 @@ class JavaFile {
bool isFile() {
return _newFile().existsSync();
}
- bool isDirectory() {
- return _newDirectory().existsSync();
- }
- Uri toURI() {
- String path = getAbsolutePath();
- return pathos.toUri(path);
- }
- String readAsStringSync() => _newFile().readAsStringSync();
int lastModified() {
if (!_newFile().existsSync()) return 0;
return _newFile().lastModifiedSync().millisecondsSinceEpoch;
@@ -134,6 +83,59 @@ class JavaFile {
}
return files;
}
- File _newFile() => new File(_path);
+ String readAsStringSync() => _newFile().readAsStringSync();
+ String toString() => _path.toString();
+ Uri toURI() {
+ String path = getAbsolutePath();
+ return pathos.toUri(path);
+ }
Directory _newDirectory() => new Directory(_path);
+ File _newFile() => new File(_path);
+}
+
+class JavaSystemIO {
+ static Map<String, String> _properties = new Map();
+ static String getenv(String name) => Platform.environment[name];
+ static String getProperty(String name) {
+ {
+ String value = _properties[name];
+ if (value != null) {
+ return value;
+ }
+ }
+ if (name == 'os.name') {
+ return Platform.operatingSystem;
+ }
+ if (name == 'line.separator') {
+ if (Platform.isWindows) {
+ return '\r\n';
+ }
+ return '\n';
+ }
+ if (name == 'com.google.dart.sdk') {
+ String exec = Platform.executable;
+ if (exec.length != 0) {
+ String sdkPath;
+ // may be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling
+ {
+ var outDir = pathos.dirname(pathos.dirname(exec));
+ sdkPath = pathos.join(pathos.dirname(outDir), "sdk");
+ if (new Directory(sdkPath).existsSync()) {
+ _properties[name] = sdkPath;
+ return sdkPath;
+ }
+ }
+ // probably be "dart-sdk/bin/dart"
+ sdkPath = pathos.dirname(pathos.dirname(exec));
+ _properties[name] = sdkPath;
+ return sdkPath;
+ }
+ }
+ return null;
+ }
+ static String setProperty(String name, String value) {
+ String oldValue = _properties[name];
+ _properties[name] = value;
+ return oldValue;
+ }
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/java_engine.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698