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

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

Issue 958373003: Don't remove indexing operations on potential source changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 path = posix.normalize(path); 104 path = posix.normalize(path);
105 newFolder(posix.dirname(path)); 105 newFolder(posix.dirname(path));
106 _MemoryFile file = new _MemoryFile(this, path); 106 _MemoryFile file = new _MemoryFile(this, path);
107 _pathToResource[path] = file; 107 _pathToResource[path] = file;
108 _pathToContent[path] = content; 108 _pathToContent[path] = content;
109 _pathToTimestamp[path] = stamp != null ? stamp : nextStamp++; 109 _pathToTimestamp[path] = stamp != null ? stamp : nextStamp++;
110 _notifyWatchers(path, ChangeType.ADD); 110 _notifyWatchers(path, ChangeType.ADD);
111 return file; 111 return file;
112 } 112 }
113 113
114 File updateFile(String path, String content, [int stamp]) {
115 path = posix.normalize(path);
116 newFolder(posix.dirname(path));
117 _MemoryFile file = new _MemoryFile(this, path);
118 _pathToResource[path] = file;
119 _pathToContent[path] = content;
120 _pathToTimestamp[path] = stamp != null ? stamp : nextStamp++;
121 _notifyWatchers(path, ChangeType.MODIFY);
122 return file;
123 }
124
114 Folder newFolder(String path) { 125 Folder newFolder(String path) {
115 path = posix.normalize(path); 126 path = posix.normalize(path);
116 if (!path.startsWith('/')) { 127 if (!path.startsWith('/')) {
117 throw new ArgumentError("Path must start with '/'"); 128 throw new ArgumentError("Path must start with '/'");
118 } 129 }
119 _MemoryResource resource = _pathToResource[path]; 130 _MemoryResource resource = _pathToResource[path];
120 if (resource == null) { 131 if (resource == null) {
121 String parentPath = posix.dirname(path); 132 String parentPath = posix.dirname(path);
122 if (parentPath != path) { 133 if (parentPath != path) {
123 newFolder(parentPath); 134 newFolder(parentPath);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 bool operator ==(other) { 422 bool operator ==(other) {
412 if (runtimeType != other.runtimeType) { 423 if (runtimeType != other.runtimeType) {
413 return false; 424 return false;
414 } 425 }
415 return path == other.path; 426 return path == other.path;
416 } 427 }
417 428
418 @override 429 @override
419 String toString() => path; 430 String toString() => path;
420 } 431 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698