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

Side by Side Diff: pkg/analyzer-experimental/lib/src/generated/java_io.dart

Issue 12671003: Push new analyzer-experimental with Resolver and ResolverTest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library java.io; 1 library java.io;
2 2
3 import "dart:io"; 3 import "dart:io";
4 import "dart:uri"; 4 import "dart:uri";
5 5
6 class JavaSystemIO { 6 class JavaSystemIO {
7 static Map<String, String> _properties = new Map();
7 static String getProperty(String name) { 8 static String getProperty(String name) {
9 {
10 String value = _properties[name];
11 if (value != null) {
12 return value;
13 }
14 }
8 if (name == 'os.name') { 15 if (name == 'os.name') {
9 return Platform.operatingSystem; 16 return Platform.operatingSystem;
10 } 17 }
11 if (name == 'line.separator') { 18 if (name == 'line.separator') {
12 if (Platform.operatingSystem == 'windows') { 19 if (Platform.operatingSystem == 'windows') {
13 return '\r\n'; 20 return '\r\n';
14 } 21 }
15 return '\n'; 22 return '\n';
16 } 23 }
24 if (name == 'com.google.dart.sdk') {
25 String exec = new Options().executable;
26 if (exec.length != 0) {
27 String sdkPath = new Path(exec).directoryPath.directoryPath.toString();
28 _properties[name] = sdkPath;
29 return sdkPath;
30 }
31 }
17 return null; 32 return null;
18 } 33 }
34 static String setProperty(String name, String value) {
35 String oldValue = _properties[name];
36 _properties[name] = value;
37 return oldValue;
38 }
19 static String getenv(String name) => Platform.environment[name]; 39 static String getenv(String name) => Platform.environment[name];
20 } 40 }
21 41
22 class JavaFile { 42 class JavaFile {
23 static final String separator = Platform.pathSeparator; 43 static final String separator = Platform.pathSeparator;
24 static final int separatorChar = Platform.pathSeparator.codeUnitAt(0); 44 static final int separatorChar = Platform.pathSeparator.codeUnitAt(0);
25 Path _path; 45 Path _path;
26 JavaFile(String path) { 46 JavaFile(String path) {
27 this._path = new Path(path); 47 this._path = new Path(path);
28 } 48 }
29 JavaFile.relative(JavaFile base, String child) { 49 JavaFile.relative(JavaFile base, String child) {
30 this._path = base._path.join(new Path(child)); 50 this._path = base._path.join(new Path(child));
31 } 51 }
32 JavaFile.fromUri(Uri uri) : this(uri.path); 52 JavaFile.fromUri(Uri uri) : this(uri.path);
33 int get hashCode => _path.hashCode; 53 int get hashCode => _path.hashCode;
34 bool operator ==(other) { 54 bool operator ==(other) {
35 return other is JavaFile && _path == other._path; 55 return other is JavaFile && other._path.toNativePath() == _path.toNativePath ();
36 } 56 }
37 String getPath() => _path.toNativePath(); 57 String getPath() => _path.toNativePath();
38 String getName() => _path.filename; 58 String getName() => _path.filename;
39 String getParent() => _path.directoryPath.toNativePath(); 59 String getParent() => _path.directoryPath.toNativePath();
40 JavaFile getParentFile() => new JavaFile(getParent()); 60 JavaFile getParentFile() => new JavaFile(getParent());
41 String getAbsolutePath() => _path.canonicalize().toNativePath(); 61 String getAbsolutePath() => _path.canonicalize().toNativePath();
42 String getCanonicalPath() => _path.canonicalize().toNativePath(); 62 String getCanonicalPath() => _path.canonicalize().toNativePath();
43 JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath()); 63 JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath());
44 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath()); 64 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath());
45 bool exists() => _newFile().existsSync(); 65 bool exists() {
66 if (_newFile().existsSync()) {
67 return true;
68 }
69 if (_newDirectory().existsSync()) {
70 return true;
71 }
72 return false;
73 }
46 Uri toURI() => new Uri.fromComponents(path: _path.toString()); 74 Uri toURI() => new Uri.fromComponents(path: _path.toString());
47 String readAsStringSync() => _newFile().readAsStringSync(); 75 String readAsStringSync() => _newFile().readAsStringSync();
48 int lastModified() => _newFile().lastModifiedSync().millisecondsSinceEpoch; 76 int lastModified() => _newFile().lastModifiedSync().millisecondsSinceEpoch;
49 File _newFile() => new File.fromPath(_path); 77 File _newFile() => new File.fromPath(_path);
78 Directory _newDirectory() => new Directory.fromPath(_path);
50 } 79 }
OLDNEW
« no previous file with comments | « pkg/analyzer-experimental/lib/src/generated/java_core.dart ('k') | pkg/analyzer-experimental/lib/src/generated/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698