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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); | 108 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); |
109 | 109 |
110 /** | 110 /** |
111 * We are about to start computing the package map. | 111 * We are about to start computing the package map. |
112 */ | 112 */ |
113 void beginComputePackageMap() { | 113 void beginComputePackageMap() { |
114 // Do nothing. | 114 // Do nothing. |
115 } | 115 } |
116 | 116 |
117 /** | 117 /** |
| 118 * Compute the set of files that are being flushed, this is defined as |
| 119 * the set of sources in the removed context (context.sources), that are |
| 120 * orphaned by this context being removed (no other context includes this |
| 121 * file.) |
| 122 */ |
| 123 List<String> computeFlushedFiles(Folder folder) { |
| 124 AnalysisContext context = _contexts[folder].context; |
| 125 HashSet<String> flushedFiles = new HashSet<String>(); |
| 126 for (Source source in context.sources) { |
| 127 flushedFiles.add(source.fullName); |
| 128 } |
| 129 for (_ContextInfo contextInfo in _contexts.values) { |
| 130 AnalysisContext contextN = contextInfo.context; |
| 131 if (context != contextN) { |
| 132 for (Source source in contextN.sources) { |
| 133 flushedFiles.remove(source.fullName); |
| 134 } |
| 135 } |
| 136 } |
| 137 return flushedFiles.toList(growable:false); |
| 138 } |
| 139 |
| 140 /** |
118 * We have finished computing the package map. | 141 * We have finished computing the package map. |
119 */ | 142 */ |
120 void endComputePackageMap() { | 143 void endComputePackageMap() { |
121 // Do nothing. | 144 // Do nothing. |
122 } | 145 } |
123 | 146 |
124 /** | 147 /** |
125 * Returns `true` if the given absolute [path] is in one of the current | 148 * Returns `true` if the given absolute [path] is in one of the current |
126 * root folders and is not excluded. | 149 * root folders and is not excluded. |
127 */ | 150 */ |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 return excludes(resource.path); | 757 return excludes(resource.path); |
735 } | 758 } |
736 | 759 |
737 /** | 760 /** |
738 * Returns `true` if [path] is the pubspec file of this context. | 761 * Returns `true` if [path] is the pubspec file of this context. |
739 */ | 762 */ |
740 bool isPubspec(String path) { | 763 bool isPubspec(String path) { |
741 return path == pubspecPath; | 764 return path == pubspecPath; |
742 } | 765 } |
743 } | 766 } |
OLD | NEW |