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 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 |
| 11 import 'package:analyzer/file_system/file_system.dart'; |
11 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; | 12 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; |
12 import 'package:analyzer/src/generated/source_io.dart'; | 13 import 'package:analyzer/src/generated/source_io.dart'; |
13 import 'package:analyzer/src/util/absolute_path.dart'; | 14 import 'package:analyzer/src/util/absolute_path.dart'; |
14 import 'package:path/path.dart'; | 15 import 'package:path/path.dart'; |
15 import 'package:watcher/watcher.dart'; | 16 import 'package:watcher/watcher.dart'; |
16 | 17 |
17 import 'file_system.dart'; | |
18 | |
19 /** | 18 /** |
20 * An in-memory implementation of [ResourceProvider]. | 19 * An in-memory implementation of [ResourceProvider]. |
21 * Use `/` as a path separator. | 20 * Use `/` as a path separator. |
22 */ | 21 */ |
23 class MemoryResourceProvider implements ResourceProvider { | 22 class MemoryResourceProvider implements ResourceProvider { |
24 final Map<String, _MemoryResource> _pathToResource = | 23 final Map<String, _MemoryResource> _pathToResource = |
25 new HashMap<String, _MemoryResource>(); | 24 new HashMap<String, _MemoryResource>(); |
26 final Map<String, String> _pathToContent = new HashMap<String, String>(); | 25 final Map<String, String> _pathToContent = new HashMap<String, String>(); |
27 final Map<String, int> _pathToTimestamp = new HashMap<String, int>(); | 26 final Map<String, int> _pathToTimestamp = new HashMap<String, int>(); |
28 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers = | 27 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers = |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 bool operator ==(other) { | 489 bool operator ==(other) { |
491 if (runtimeType != other.runtimeType) { | 490 if (runtimeType != other.runtimeType) { |
492 return false; | 491 return false; |
493 } | 492 } |
494 return path == other.path; | 493 return path == other.path; |
495 } | 494 } |
496 | 495 |
497 @override | 496 @override |
498 String toString() => path; | 497 String toString() => path; |
499 } | 498 } |
OLD | NEW |