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

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

Issue 444193002: Add Folder.contains(path) and use it in ContextDirectoryManager. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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 9
10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; 10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 @override 284 @override
285 String canonicalizePath(String relPath) { 285 String canonicalizePath(String relPath) {
286 relPath = posix.normalize(relPath); 286 relPath = posix.normalize(relPath);
287 String childPath = posix.join(path, relPath); 287 String childPath = posix.join(path, relPath);
288 childPath = posix.normalize(childPath); 288 childPath = posix.normalize(childPath);
289 return childPath; 289 return childPath;
290 } 290 }
291 291
292 @override 292 @override
293 bool contains(String path) {
294 return posix.isWithin(this.path, path);
295 }
296
297 @override
293 Resource getChild(String relPath) { 298 Resource getChild(String relPath) {
294 String childPath = canonicalizePath(relPath); 299 String childPath = canonicalizePath(relPath);
295 _MemoryResource resource = _provider._pathToResource[childPath]; 300 _MemoryResource resource = _provider._pathToResource[childPath];
296 if (resource == null) { 301 if (resource == null) {
297 resource = new _MemoryFile(_provider, childPath); 302 resource = new _MemoryFile(_provider, childPath);
298 } 303 }
299 return resource; 304 return resource;
300 } 305 }
301 306
302 @override 307 @override
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 bool operator ==(other) { 348 bool operator ==(other) {
344 if (runtimeType != other.runtimeType) { 349 if (runtimeType != other.runtimeType) {
345 return false; 350 return false;
346 } 351 }
347 return path == other.path; 352 return path == other.path;
348 } 353 }
349 354
350 @override 355 @override
351 String toString() => path; 356 String toString() => path;
352 } 357 }
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