| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.source.io; | 3 library engine.source.io; |
| 4 import 'source.dart'; | 4 import 'source.dart'; |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 import 'java_io.dart'; | 7 import 'java_io.dart'; |
| 8 import 'sdk.dart' show DartSdk; | 8 import 'sdk.dart' show DartSdk; |
| 9 import 'engine.dart' show AnalysisContext, AnalysisEngine; | 9 import 'engine.dart' show AnalysisContext, AnalysisEngine; |
| 10 export 'source.dart'; | 10 export 'source.dart'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 * Initialize a newly created source object. | 49 * Initialize a newly created source object. |
| 50 * | 50 * |
| 51 * @param contentCache the content cache used to access the contents of this s
ource | 51 * @param contentCache the content cache used to access the contents of this s
ource |
| 52 * @param file the file represented by this source | 52 * @param file the file represented by this source |
| 53 * @param flags `true` if this source is in one of the system libraries | 53 * @param flags `true` if this source is in one of the system libraries |
| 54 */ | 54 */ |
| 55 FileBasedSource.con2(ContentCache contentCache, JavaFile file, UriKind uriKind
) { | 55 FileBasedSource.con2(ContentCache contentCache, JavaFile file, UriKind uriKind
) { |
| 56 this._contentCache = contentCache; | 56 this._contentCache = contentCache; |
| 57 this._file = file; | 57 this._file = file; |
| 58 this._uriKind = uriKind; | 58 this._uriKind = uriKind; |
| 59 this._encoding = "${uriKind.encoding}${file.toURI().toString()}"; | 59 if (file.getPath().indexOf(':') > 2) { |
| 60 try { |
| 61 throw new IllegalArgumentException("Invalid source path: ${file}"); |
| 62 } on IllegalArgumentException catch (e) { |
| 63 AnalysisEngine.instance.logger.logError3(e); |
| 64 throw e; |
| 65 } |
| 66 } |
| 60 } | 67 } |
| 61 bool operator ==(Object object) => object != null && this.runtimeType == objec
t.runtimeType && _file == ((object as FileBasedSource))._file; | 68 bool operator ==(Object object) => object != null && this.runtimeType == objec
t.runtimeType && _file == ((object as FileBasedSource))._file; |
| 62 bool exists() => _contentCache.getContents(this) != null || (_file.exists() &&
!_file.isDirectory()); | 69 bool exists() => _contentCache.getContents(this) != null || (_file.exists() &&
!_file.isDirectory()); |
| 63 void getContents(Source_ContentReceiver receiver) { | 70 void getContents(Source_ContentReceiver receiver) { |
| 64 { | 71 { |
| 65 String contents = _contentCache.getContents(this); | 72 String contents = _contentCache.getContents(this); |
| 66 if (contents != null) { | 73 if (contents != null) { |
| 67 receiver.accept2(contents, _contentCache.getModificationStamp(this)); | 74 receiver.accept2(contents, _contentCache.getModificationStamp(this)); |
| 68 return; | 75 return; |
| 69 } | 76 } |
| 70 } | 77 } |
| 71 receiver.accept2(_file.readAsStringSync(), _file.lastModified()); | 78 receiver.accept2(_file.readAsStringSync(), _file.lastModified()); |
| 72 } | 79 } |
| 73 String get encoding => _encoding; | 80 String get encoding { |
| 81 if (_encoding == null) { |
| 82 _encoding = "${_uriKind.encoding}${_file.toURI().toString()}"; |
| 83 } |
| 84 return _encoding; |
| 85 } |
| 74 String get fullName => _file.getAbsolutePath(); | 86 String get fullName => _file.getAbsolutePath(); |
| 75 int get modificationStamp { | 87 int get modificationStamp { |
| 76 int stamp = _contentCache.getModificationStamp(this); | 88 int stamp = _contentCache.getModificationStamp(this); |
| 77 if (stamp != null) { | 89 if (stamp != null) { |
| 78 return stamp; | 90 return stamp; |
| 79 } | 91 } |
| 80 return _file.lastModified(); | 92 return _file.lastModified(); |
| 81 } | 93 } |
| 82 String get shortName => _file.getName(); | 94 String get shortName => _file.getName(); |
| 83 UriKind get uriKind => _uriKind; | 95 UriKind get uriKind => _uriKind; |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 332 } |
| 321 return null; | 333 return null; |
| 322 } | 334 } |
| 323 Source resolveAbsolute(ContentCache contentCache, Uri uri) { | 335 Source resolveAbsolute(ContentCache contentCache, Uri uri) { |
| 324 if (!isFileUri(uri)) { | 336 if (!isFileUri(uri)) { |
| 325 return null; | 337 return null; |
| 326 } | 338 } |
| 327 return new FileBasedSource.con1(contentCache, new JavaFile.fromUri(uri)); | 339 return new FileBasedSource.con1(contentCache, new JavaFile.fromUri(uri)); |
| 328 } | 340 } |
| 329 } | 341 } |
| OLD | NEW |