| 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 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 _notifyWatchers(newPath, ChangeType.ADD); | 181 _notifyWatchers(newPath, ChangeType.ADD); |
| 182 return newFile; | 182 return newFile; |
| 183 } | 183 } |
| 184 | 184 |
| 185 File updateFile(String path, String content, [int stamp]) { | 185 File updateFile(String path, String content, [int stamp]) { |
| 186 path = pathContext.normalize(path); | 186 path = pathContext.normalize(path); |
| 187 newFolder(pathContext.dirname(path)); | 187 newFolder(pathContext.dirname(path)); |
| 188 _MemoryFile file = new _MemoryFile(this, path); | 188 _MemoryFile file = new _MemoryFile(this, path); |
| 189 _pathToResource[path] = file; | 189 _pathToResource[path] = file; |
| 190 _pathToContent[path] = content; | 190 _pathToContent[path] = content; |
| 191 _pathToTimestamp[path] = stamp != null ? stamp : nextStamp++; | 191 _pathToTimestamp[path] = stamp ?? nextStamp++; |
| 192 _notifyWatchers(path, ChangeType.MODIFY); | 192 _notifyWatchers(path, ChangeType.MODIFY); |
| 193 return file; | 193 return file; |
| 194 } | 194 } |
| 195 | 195 |
| 196 void _checkFileAtPath(String path) { | 196 void _checkFileAtPath(String path) { |
| 197 _MemoryResource resource = _pathToResource[path]; | 197 _MemoryResource resource = _pathToResource[path]; |
| 198 if (resource is! _MemoryFile) { | 198 if (resource is! _MemoryFile) { |
| 199 throw new ArgumentError( | 199 throw new ArgumentError( |
| 200 'File expected at "$path" but ${resource.runtimeType} found'); | 200 'File expected at "$path" but ${resource.runtimeType} found'); |
| 201 } | 201 } |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 bool operator ==(other) { | 570 bool operator ==(other) { |
| 571 if (runtimeType != other.runtimeType) { | 571 if (runtimeType != other.runtimeType) { |
| 572 return false; | 572 return false; |
| 573 } | 573 } |
| 574 return path == other.path; | 574 return path == other.path; |
| 575 } | 575 } |
| 576 | 576 |
| 577 @override | 577 @override |
| 578 String toString() => path; | 578 String toString() => path; |
| 579 } | 579 } |
| OLD | NEW |