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

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

Issue 1511833004: Validate that root paths are absolute and normalized. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 memory_file_system; 5 library 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 12 matching lines...) Expand all
23 class MemoryResourceProvider implements ResourceProvider { 23 class MemoryResourceProvider implements ResourceProvider {
24 final Map<String, _MemoryResource> _pathToResource = 24 final Map<String, _MemoryResource> _pathToResource =
25 new HashMap<String, _MemoryResource>(); 25 new HashMap<String, _MemoryResource>();
26 final Map<String, String> _pathToContent = new HashMap<String, String>(); 26 final Map<String, String> _pathToContent = new HashMap<String, String>();
27 final Map<String, int> _pathToTimestamp = new HashMap<String, int>(); 27 final Map<String, int> _pathToTimestamp = new HashMap<String, int>();
28 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers = 28 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers =
29 new HashMap<String, List<StreamController<WatchEvent>>>(); 29 new HashMap<String, List<StreamController<WatchEvent>>>();
30 int nextStamp = 0; 30 int nextStamp = 0;
31 31
32 final AbsolutePathContext absolutePathContext = 32 final AbsolutePathContext absolutePathContext =
33 new AbsolutePathContext(posix.separator); 33 new AbsolutePathContext(false);
34 34
35 @override 35 @override
36 Context get pathContext => posix; 36 Context get pathContext => posix;
37 37
38 /** 38 /**
39 * Delete the file with the given path. 39 * Delete the file with the given path.
40 */ 40 */
41 void deleteFile(String path) { 41 void deleteFile(String path) {
42 _checkFileAtPath(path); 42 _checkFileAtPath(path);
43 _pathToResource.remove(path); 43 _pathToResource.remove(path);
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 bool operator ==(other) { 490 bool operator ==(other) {
491 if (runtimeType != other.runtimeType) { 491 if (runtimeType != other.runtimeType) {
492 return false; 492 return false;
493 } 493 }
494 return path == other.path; 494 return path == other.path;
495 } 495 }
496 496
497 @override 497 @override
498 String toString() => path; 498 String toString() => path;
499 } 499 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698