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

Side by Side Diff: pkg/analyzer/lib/file_system/memory_file_system.dart

Issue 1749143003: Add @overrides to (a lot of) analyzer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: options Created 4 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
OLDNEW
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 11 matching lines...) Expand all
22 class MemoryResourceProvider implements ResourceProvider { 22 class MemoryResourceProvider implements ResourceProvider {
23 final Map<String, _MemoryResource> _pathToResource = 23 final Map<String, _MemoryResource> _pathToResource =
24 new HashMap<String, _MemoryResource>(); 24 new HashMap<String, _MemoryResource>();
25 final Map<String, String> _pathToContent = new HashMap<String, String>(); 25 final Map<String, String> _pathToContent = new HashMap<String, String>();
26 final Map<String, int> _pathToTimestamp = new HashMap<String, int>(); 26 final Map<String, int> _pathToTimestamp = new HashMap<String, int>();
27 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers = 27 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers =
28 new HashMap<String, List<StreamController<WatchEvent>>>(); 28 new HashMap<String, List<StreamController<WatchEvent>>>();
29 int nextStamp = 0; 29 int nextStamp = 0;
30 30
31 final Context _pathContext; 31 final Context _pathContext;
32 @override
32 final AbsolutePathContext absolutePathContext; 33 final AbsolutePathContext absolutePathContext;
33 34
34 MemoryResourceProvider({bool isWindows: false}) 35 MemoryResourceProvider({bool isWindows: false})
35 : _pathContext = isWindows ? windows : posix, 36 : _pathContext = isWindows ? windows : posix,
36 absolutePathContext = new AbsolutePathContext(isWindows); 37 absolutePathContext = new AbsolutePathContext(isWindows);
37 38
38 @override 39 @override
39 Context get pathContext => _pathContext; 40 Context get pathContext => _pathContext;
40 41
41 /** 42 /**
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 : super(provider, path); 205 : super(provider, path);
205 206
206 @override 207 @override
207 Stream<WatchEvent> get changes { 208 Stream<WatchEvent> get changes {
208 throw new FileSystemException(path, "File does not exist"); 209 throw new FileSystemException(path, "File does not exist");
209 } 210 }
210 211
211 @override 212 @override
212 bool get exists => false; 213 bool get exists => false;
213 214
215 @override
214 int get modificationStamp { 216 int get modificationStamp {
215 int stamp = _provider._pathToTimestamp[path]; 217 int stamp = _provider._pathToTimestamp[path];
216 if (stamp == null) { 218 if (stamp == null) {
217 throw new FileSystemException(path, "File does not exist"); 219 throw new FileSystemException(path, "File does not exist");
218 } 220 }
219 return stamp; 221 return stamp;
220 } 222 }
221 223
222 String get _content { 224 String get _content {
223 throw new FileSystemException(path, 'File could not be read'); 225 throw new FileSystemException(path, 'File could not be read');
(...skipping 18 matching lines...) Expand all
242 /** 244 /**
243 * An in-memory implementation of [File]. 245 * An in-memory implementation of [File].
244 */ 246 */
245 class _MemoryFile extends _MemoryResource implements File { 247 class _MemoryFile extends _MemoryResource implements File {
246 _MemoryFile(MemoryResourceProvider provider, String path) 248 _MemoryFile(MemoryResourceProvider provider, String path)
247 : super(provider, path); 249 : super(provider, path);
248 250
249 @override 251 @override
250 bool get exists => _provider._pathToResource[path] is _MemoryFile; 252 bool get exists => _provider._pathToResource[path] is _MemoryFile;
251 253
254 @override
252 int get modificationStamp { 255 int get modificationStamp {
253 int stamp = _provider._pathToTimestamp[path]; 256 int stamp = _provider._pathToTimestamp[path];
254 if (stamp == null) { 257 if (stamp == null) {
255 throw new FileSystemException(path, 'File "$path" does not exist.'); 258 throw new FileSystemException(path, 'File "$path" does not exist.');
256 } 259 }
257 return stamp; 260 return stamp;
258 } 261 }
259 262
260 String get _content { 263 String get _content {
261 String content = _provider._pathToContent[path]; 264 String content = _provider._pathToContent[path];
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 * Map from encoded URI/filepath pair to a unique integer identifier. This 299 * Map from encoded URI/filepath pair to a unique integer identifier. This
297 * identifier is used for equality tests and hash codes. 300 * identifier is used for equality tests and hash codes.
298 * 301 *
299 * The URI and filepath are joined into a pair by separating them with an '@' 302 * The URI and filepath are joined into a pair by separating them with an '@'
300 * character. 303 * character.
301 */ 304 */
302 static final Map<String, int> _idTable = new HashMap<String, int>(); 305 static final Map<String, int> _idTable = new HashMap<String, int>();
303 306
304 final _MemoryFile file; 307 final _MemoryFile file;
305 308
309 @override
306 final Uri uri; 310 final Uri uri;
307 311
308 /** 312 /**
309 * The unique ID associated with this [_MemoryFileSource]. 313 * The unique ID associated with this [_MemoryFileSource].
310 */ 314 */
311 final int id; 315 final int id;
312 316
313 _MemoryFileSource(_MemoryFile file, Uri uri) 317 _MemoryFileSource(_MemoryFile file, Uri uri)
314 : uri = uri, 318 : uri = uri,
315 file = file, 319 file = file,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 450 }
447 return contains(path); 451 return contains(path);
448 } 452 }
449 } 453 }
450 454
451 /** 455 /**
452 * An in-memory implementation of [Resource]. 456 * An in-memory implementation of [Resource].
453 */ 457 */
454 abstract class _MemoryResource implements Resource { 458 abstract class _MemoryResource implements Resource {
455 final MemoryResourceProvider _provider; 459 final MemoryResourceProvider _provider;
460 @override
456 final String path; 461 final String path;
457 462
458 _MemoryResource(this._provider, this.path); 463 _MemoryResource(this._provider, this.path);
459 464
460 Stream<WatchEvent> get changes { 465 Stream<WatchEvent> get changes {
461 StreamController<WatchEvent> streamController = 466 StreamController<WatchEvent> streamController =
462 new StreamController<WatchEvent>(); 467 new StreamController<WatchEvent>();
463 if (!_provider._pathToWatchers.containsKey(path)) { 468 if (!_provider._pathToWatchers.containsKey(path)) {
464 _provider._pathToWatchers[path] = <StreamController<WatchEvent>>[]; 469 _provider._pathToWatchers[path] = <StreamController<WatchEvent>>[];
465 } 470 }
(...skipping 26 matching lines...) Expand all
492 bool operator ==(other) { 497 bool operator ==(other) {
493 if (runtimeType != other.runtimeType) { 498 if (runtimeType != other.runtimeType) {
494 return false; 499 return false;
495 } 500 }
496 return path == other.path; 501 return path == other.path;
497 } 502 }
498 503
499 @override 504 @override
500 String toString() => path; 505 String toString() => path;
501 } 506 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/file_system.dart ('k') | pkg/analyzer/lib/file_system/physical_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698