| 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 HashSet<String> flushedFiles = new HashSet<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); |
| 133 } |
| 134 } |
| 135 } |
| 136 return flushedFiles.toList(growable:false); |
| 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 return excludes(resource.path); | 748 return excludes(resource.path); |
| 726 } | 749 } |
| 727 | 750 |
| 728 /** | 751 /** |
| 729 * Returns `true` if [path] is the pubspec file of this context. | 752 * Returns `true` if [path] is the pubspec file of this context. |
| 730 */ | 753 */ |
| 731 bool isPubspec(String path) { | 754 bool isPubspec(String path) { |
| 732 return path == pubspecPath; | 755 return path == pubspecPath; |
| 733 } | 756 } |
| 734 } | 757 } |
| OLD | NEW |