| 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 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |