Chromium Code Reviews| 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 context.directory.manager; | 5 library context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); | 107 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * We are about to start computing the package map. | 110 * We are about to start computing the package map. |
| 111 */ | 111 */ |
| 112 void beginComputePackageMap() { | 112 void beginComputePackageMap() { |
| 113 // Do nothing. | 113 // Do nothing. |
| 114 } | 114 } |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * Compute the set of files that are being flushed, this is defined as | |
| 118 * the set of sources in the removed context (context.sources), that are | |
| 119 * orphaned by this context being removed (no other context includes this | |
| 120 * file.) | |
| 121 */ | |
| 122 List<String> computeFlushedFiles(Folder folder) { | |
| 123 AnalysisContext context = _contexts[folder].context; | |
| 124 List<String> flushedFiles = new List<String>(); | |
| 125 for (Source source in context.sources) { | |
| 126 flushedFiles.add(source.fullName); | |
| 127 } | |
| 128 for (_ContextInfo contextInfo in _contexts.values) { | |
| 129 AnalysisContext contextN = contextInfo.context; | |
| 130 if (context != contextN) { | |
| 131 for (Source source in contextN.sources) { | |
| 132 flushedFiles.remove(source.fullName); | |
|
Paul Berry
2015/03/09 22:40:10
This is an O(n^2) algorithm, where n is the number
jwren
2015/03/10 14:52:40
Done. Of course, after all of our conversations a
| |
| 133 } | |
| 134 } | |
| 135 } | |
| 136 return flushedFiles; | |
| 137 } | |
| 138 | |
| 139 /** | |
| 117 * We have finished computing the package map. | 140 * We have finished computing the package map. |
| 118 */ | 141 */ |
| 119 void endComputePackageMap() { | 142 void endComputePackageMap() { |
| 120 // Do nothing. | 143 // Do nothing. |
| 121 } | 144 } |
| 122 | 145 |
| 123 /** | 146 /** |
| 124 * Returns `true` if the given absolute [path] is in one of the current | 147 * Returns `true` if the given absolute [path] is in one of the current |
| 125 * root folders and is not excluded. | 148 * root folders and is not excluded. |
| 126 */ | 149 */ |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 return excludes(resource.path); | 733 return excludes(resource.path); |
| 711 } | 734 } |
| 712 | 735 |
| 713 /** | 736 /** |
| 714 * Returns `true` if [path] is the pubspec file of this context. | 737 * Returns `true` if [path] is the pubspec file of this context. |
| 715 */ | 738 */ |
| 716 bool isPubspec(String path) { | 739 bool isPubspec(String path) { |
| 717 return path == pubspecPath; | 740 return path == pubspecPath; |
| 718 } | 741 } |
| 719 } | 742 } |
| OLD | NEW |