| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.file_system.memory_file_system; | 5 library analyzer.file_system.memory_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:core' hide Resource; | 9 import 'dart:core' hide Resource; |
| 10 | 10 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 String get _content { | 274 String get _content { |
| 275 throw new FileSystemException(path, 'File could not be read'); | 275 throw new FileSystemException(path, 'File could not be read'); |
| 276 } | 276 } |
| 277 | 277 |
| 278 @override | 278 @override |
| 279 Source createSource([Uri uri]) { | 279 Source createSource([Uri uri]) { |
| 280 throw new FileSystemException(path, 'File could not be read'); | 280 throw new FileSystemException(path, 'File could not be read'); |
| 281 } | 281 } |
| 282 | 282 |
| 283 @override | 283 @override |
| 284 void delete() { |
| 285 throw new FileSystemException(path, 'File could not be deleted'); |
| 286 } |
| 287 |
| 288 @override |
| 284 bool isOrContains(String path) { | 289 bool isOrContains(String path) { |
| 285 return path == this.path; | 290 return path == this.path; |
| 286 } | 291 } |
| 287 | 292 |
| 288 @override | 293 @override |
| 289 List<int> readAsBytesSync() { | 294 List<int> readAsBytesSync() { |
| 290 throw new FileSystemException(path, 'File could not be read'); | 295 throw new FileSystemException(path, 'File could not be read'); |
| 291 } | 296 } |
| 292 | 297 |
| 293 @override | 298 @override |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 340 |
| 336 @override | 341 @override |
| 337 Source createSource([Uri uri]) { | 342 Source createSource([Uri uri]) { |
| 338 if (uri == null) { | 343 if (uri == null) { |
| 339 uri = _provider.pathContext.toUri(path); | 344 uri = _provider.pathContext.toUri(path); |
| 340 } | 345 } |
| 341 return new _MemoryFileSource(this, uri); | 346 return new _MemoryFileSource(this, uri); |
| 342 } | 347 } |
| 343 | 348 |
| 344 @override | 349 @override |
| 350 void delete() { |
| 351 _provider.deleteFile(path); |
| 352 } |
| 353 |
| 354 @override |
| 345 bool isOrContains(String path) { | 355 bool isOrContains(String path) { |
| 346 return path == this.path; | 356 return path == this.path; |
| 347 } | 357 } |
| 348 | 358 |
| 349 @override | 359 @override |
| 350 List<int> readAsBytesSync() { | 360 List<int> readAsBytesSync() { |
| 351 List<int> bytes = _provider._pathToBytes[path]; | 361 List<int> bytes = _provider._pathToBytes[path]; |
| 352 if (bytes == null) { | 362 if (bytes == null) { |
| 353 throw new FileSystemException(path, 'File "$path" is not binary.'); | 363 throw new FileSystemException(path, 'File "$path" is not binary.'); |
| 354 } | 364 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 childPath = _provider.pathContext.normalize(childPath); | 491 childPath = _provider.pathContext.normalize(childPath); |
| 482 return childPath; | 492 return childPath; |
| 483 } | 493 } |
| 484 | 494 |
| 485 @override | 495 @override |
| 486 bool contains(String path) { | 496 bool contains(String path) { |
| 487 return _provider.pathContext.isWithin(this.path, path); | 497 return _provider.pathContext.isWithin(this.path, path); |
| 488 } | 498 } |
| 489 | 499 |
| 490 @override | 500 @override |
| 501 void delete() { |
| 502 _provider.deleteFolder(path); |
| 503 } |
| 504 |
| 505 @override |
| 491 Resource getChild(String relPath) { | 506 Resource getChild(String relPath) { |
| 492 String childPath = canonicalizePath(relPath); | 507 String childPath = canonicalizePath(relPath); |
| 493 _MemoryResource resource = _provider._pathToResource[childPath]; | 508 _MemoryResource resource = _provider._pathToResource[childPath]; |
| 494 if (resource == null) { | 509 if (resource == null) { |
| 495 resource = new _MemoryFile(_provider, childPath); | 510 resource = new _MemoryFile(_provider, childPath); |
| 496 } | 511 } |
| 497 return resource; | 512 return resource; |
| 498 } | 513 } |
| 499 | 514 |
| 500 @override | 515 @override |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 bool operator ==(other) { | 600 bool operator ==(other) { |
| 586 if (runtimeType != other.runtimeType) { | 601 if (runtimeType != other.runtimeType) { |
| 587 return false; | 602 return false; |
| 588 } | 603 } |
| 589 return path == other.path; | 604 return path == other.path; |
| 590 } | 605 } |
| 591 | 606 |
| 592 @override | 607 @override |
| 593 String toString() => path; | 608 String toString() => path; |
| 594 } | 609 } |
| OLD | NEW |