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

Side by Side Diff: pkg/analysis_server/lib/src/domain_execution.dart

Issue 1750683002: Move folderMap from AnalysisContext to ContextManager (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
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 domain.execution; 5 library domain.execution;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core' hide Resource; 9 import 'dart:core' hide Resource;
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 189
190 /** 190 /**
191 * Return `true` if the given [filePath] represents a file that is in an 191 * Return `true` if the given [filePath] represents a file that is in an
192 * analysis root. 192 * analysis root.
193 */ 193 */
194 bool _isInAnalysisRoot(String filePath) => 194 bool _isInAnalysisRoot(String filePath) =>
195 server.contextManager.isInAnalysisRoot(filePath); 195 server.contextManager.isInAnalysisRoot(filePath);
196 196
197 void _reportCurrentFileStatus() { 197 void _reportCurrentFileStatus() {
198 for (AnalysisContext context in server.getAnalysisContexts()) { 198 for (AnalysisContext context in server.analysisContexts) {
199 List<Source> librarySources = context.librarySources; 199 List<Source> librarySources = context.librarySources;
200 List<Source> clientSources = context.launchableClientLibrarySources; 200 List<Source> clientSources = context.launchableClientLibrarySources;
201 List<Source> serverSources = context.launchableServerLibrarySources; 201 List<Source> serverSources = context.launchableServerLibrarySources;
202 for (Source source in clientSources) { 202 for (Source source in clientSources) {
203 if (serverSources.remove(source)) { 203 if (serverSources.remove(source)) {
204 _sendKindNotification(source.fullName, ExecutableKind.EITHER); 204 _sendKindNotification(source.fullName, ExecutableKind.EITHER);
205 } else { 205 } else {
206 _sendKindNotification(source.fullName, ExecutableKind.CLIENT); 206 _sendKindNotification(source.fullName, ExecutableKind.CLIENT);
207 } 207 }
208 librarySources.remove(source); 208 librarySources.remove(source);
209 } 209 }
210 for (Source source in serverSources) { 210 for (Source source in serverSources) {
211 _sendKindNotification(source.fullName, ExecutableKind.SERVER); 211 _sendKindNotification(source.fullName, ExecutableKind.SERVER);
212 librarySources.remove(source); 212 librarySources.remove(source);
213 } 213 }
214 for (Source source in librarySources) { 214 for (Source source in librarySources) {
215 _sendKindNotification(source.fullName, ExecutableKind.NOT_EXECUTABLE); 215 _sendKindNotification(source.fullName, ExecutableKind.NOT_EXECUTABLE);
216 } 216 }
217 for (Source source in context.htmlSources) { 217 for (Source source in context.htmlSources) {
218 String filePath = source.fullName; 218 String filePath = source.fullName;
219 if (_isInAnalysisRoot(filePath)) { 219 if (_isInAnalysisRoot(filePath)) {
220 List<Source> libraries = 220 List<Source> libraries =
221 context.getLibrariesReferencedFromHtml(source); 221 context.getLibrariesReferencedFromHtml(source);
222 server.sendNotification(new ExecutionLaunchDataParams(filePath, 222 server.sendNotification(new ExecutionLaunchDataParams(filePath,
223 referencedFiles: _getFullNames(libraries)).toNotification()); 223 referencedFiles: _getFullNames(libraries))
224 .toNotification());
224 } 225 }
225 } 226 }
226 } 227 }
227 } 228 }
228 229
229 /** 230 /**
230 * Send a notification indicating the [kind] of the file with the given 231 * Send a notification indicating the [kind] of the file with the given
231 * [filePath], but only if the file is in an analysis root. 232 * [filePath], but only if the file is in an analysis root.
232 */ 233 */
233 void _sendKindNotification(String filePath, ExecutableKind kind) { 234 void _sendKindNotification(String filePath, ExecutableKind kind) {
234 if (_isInAnalysisRoot(filePath)) { 235 if (_isInAnalysisRoot(filePath)) {
235 server.sendNotification( 236 server.sendNotification(
236 new ExecutionLaunchDataParams(filePath, kind: kind).toNotification()); 237 new ExecutionLaunchDataParams(filePath, kind: kind).toNotification());
237 } 238 }
238 } 239 }
239 240
240 static List<String> _getFullNames(List<Source> sources) { 241 static List<String> _getFullNames(List<Source> sources) {
241 return sources.map((Source source) => source.fullName).toList(); 242 return sources.map((Source source) => source.fullName).toList();
242 } 243 }
243 } 244 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698