Simplify handling of watch events for the new analysis driver.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2463903002 .
This commit is contained in:
Konstantin Shcheglov 2016-10-31 11:00:22 -07:00
parent 6826e267b9
commit 0257eeb4f5

View file

@ -1379,6 +1379,9 @@ class ContextManagerImpl implements ContextManager {
if (resource is File) { if (resource is File) {
File file = resource; File file = resource;
if (_shouldFileBeAnalyzed(file)) { if (_shouldFileBeAnalyzed(file)) {
if (enableNewAnalysisDriver) {
info.analysisDriver.addFile(path);
} else {
ChangeSet changeSet = new ChangeSet(); ChangeSet changeSet = new ChangeSet();
Source source = createSourceInContext(info.context, file); Source source = createSourceInContext(info.context, file);
changeSet.addedSource(source); changeSet.addedSource(source);
@ -1386,6 +1389,7 @@ class ContextManagerImpl implements ContextManager {
info.sources[path] = source; info.sources[path] = source;
} }
} }
}
break; break;
case ChangeType.REMOVE: case ChangeType.REMOVE:
@ -1420,6 +1424,9 @@ class ContextManagerImpl implements ContextManager {
} }
} }
if (enableNewAnalysisDriver) {
info.analysisDriver.removeFile(path);
} else {
List<Source> sources = info.context.getSourcesWithFullName(path); List<Source> sources = info.context.getSourcesWithFullName(path);
if (!sources.isEmpty) { if (!sources.isEmpty) {
ChangeSet changeSet = new ChangeSet(); ChangeSet changeSet = new ChangeSet();
@ -1429,8 +1436,12 @@ class ContextManagerImpl implements ContextManager {
callbacks.applyChangesToContext(info.folder, changeSet); callbacks.applyChangesToContext(info.folder, changeSet);
info.sources.remove(path); info.sources.remove(path);
} }
}
break; break;
case ChangeType.MODIFY: case ChangeType.MODIFY:
if (enableNewAnalysisDriver) {
info.analysisDriver.changeFile(path);
} else {
List<Source> sources = info.context.getSourcesWithFullName(path); List<Source> sources = info.context.getSourcesWithFullName(path);
if (!sources.isEmpty) { if (!sources.isEmpty) {
ChangeSet changeSet = new ChangeSet(); ChangeSet changeSet = new ChangeSet();
@ -1439,6 +1450,7 @@ class ContextManagerImpl implements ContextManager {
}); });
callbacks.applyChangesToContext(info.folder, changeSet); callbacks.applyChangesToContext(info.folder, changeSet);
} }
}
break; break;
} }
_checkForPackagespecUpdate(path, info, info.folder); _checkForPackagespecUpdate(path, info, info.folder);