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

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

Issue 2478963002: Completion with the new analysis driver. (Closed)
Patch Set: Fixes for review comments. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_completion.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core'; 9 import 'dart:core';
10 import 'dart:io' as io; 10 import 'dart:io' as io;
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 nd.AnalysisDriver getAnalysisDriver(String path) { 578 nd.AnalysisDriver getAnalysisDriver(String path) {
579 Iterable<nd.AnalysisDriver> drivers = driverMap.values; 579 Iterable<nd.AnalysisDriver> drivers = driverMap.values;
580 if (drivers.isNotEmpty) { 580 if (drivers.isNotEmpty) {
581 return drivers.firstWhere((driver) => driver.isAddedFile(path), 581 return drivers.firstWhere((driver) => driver.isAddedFile(path),
582 orElse: () => drivers.first); 582 orElse: () => drivers.first);
583 } 583 }
584 return null; 584 return null;
585 } 585 }
586 586
587 /** 587 /**
588 * Return the analysis result for the file with the given [path]. 588 * Return the analysis result for the file with the given [path]. The file is
589 * analyzed in one of the analysis drivers to which the file was added,
590 * otherwise in the first driver, otherwise `null` is returned.
589 */ 591 */
590 Future<nd.AnalysisResult> getAnalysisResult(String path) async { 592 Future<nd.AnalysisResult> getAnalysisResult(String path) async {
591 nd.AnalysisResult result = priorityFileResults[path]; 593 nd.AnalysisResult result = priorityFileResults[path];
592 if (result != null) { 594 if (result != null) {
593 return result; 595 return result;
594 } 596 }
595 nd.AnalysisDriver driver = getAnalysisDriver(path); 597 nd.AnalysisDriver driver = getAnalysisDriver(path);
596 return driver.getResult(path); 598 return driver?.getResult(path);
597 } 599 }
598 600
599 CompilationUnitElement getCompilationUnitElement(String file) { 601 CompilationUnitElement getCompilationUnitElement(String file) {
600 ContextSourcePair pair = getContextSourcePair(file); 602 ContextSourcePair pair = getContextSourcePair(file);
601 if (pair == null) { 603 if (pair == null) {
602 return null; 604 return null;
603 } 605 }
604 // prepare AnalysisContext and Source 606 // prepare AnalysisContext and Source
605 AnalysisContext context = pair.context; 607 AnalysisContext context = pair.context;
606 Source unitSource = pair.source; 608 Source unitSource = pair.source;
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 /** 1992 /**
1991 * The [PerformanceTag] for time spent in server request handlers. 1993 * The [PerformanceTag] for time spent in server request handlers.
1992 */ 1994 */
1993 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1995 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1994 1996
1995 /** 1997 /**
1996 * The [PerformanceTag] for time spent in split store microtasks. 1998 * The [PerformanceTag] for time spent in split store microtasks.
1997 */ 1999 */
1998 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 2000 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1999 } 2001 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_completion.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698