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 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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 } | 794 } |
795 return null; | 795 return null; |
796 } | 796 } |
797 | 797 |
798 /** | 798 /** |
799 * Return a [Future] that completes with the resolved [CompilationUnit] for | 799 * Return a [Future] that completes with the resolved [CompilationUnit] for |
800 * the Dart file with the given [path], or with `null` if the file is not a | 800 * the Dart file with the given [path], or with `null` if the file is not a |
801 * Dart file or cannot be resolved. | 801 * Dart file or cannot be resolved. |
802 */ | 802 */ |
803 Future<CompilationUnit> getResolvedCompilationUnit(String path) async { | 803 Future<CompilationUnit> getResolvedCompilationUnit(String path) async { |
| 804 if (options.enableNewAnalysisDriver) { |
| 805 nd.AnalysisResult result = await getAnalysisResult(path); |
| 806 return result?.unit; |
| 807 } |
804 ContextSourcePair contextSource = getContextSourcePair(path); | 808 ContextSourcePair contextSource = getContextSourcePair(path); |
805 AnalysisContext context = contextSource.context; | 809 AnalysisContext context = contextSource.context; |
806 if (context == null) { | 810 if (context == null) { |
807 return null; | 811 return null; |
808 } | 812 } |
809 return runWithActiveContext(context, () { | 813 return runWithActiveContext(context, () { |
810 Source unitSource = contextSource.source; | 814 Source unitSource = contextSource.source; |
811 List<Source> librarySources = context.getLibrariesContaining(unitSource); | 815 List<Source> librarySources = context.getLibrariesContaining(unitSource); |
812 for (Source librarySource in librarySources) { | 816 for (Source librarySource in librarySources) { |
813 return context.resolveCompilationUnit2(unitSource, librarySource); | 817 return context.resolveCompilationUnit2(unitSource, librarySource); |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 /** | 2061 /** |
2058 * The [PerformanceTag] for time spent in server request handlers. | 2062 * The [PerformanceTag] for time spent in server request handlers. |
2059 */ | 2063 */ |
2060 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2064 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
2061 | 2065 |
2062 /** | 2066 /** |
2063 * The [PerformanceTag] for time spent in split store microtasks. | 2067 * The [PerformanceTag] for time spent in split store microtasks. |
2064 */ | 2068 */ |
2065 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2069 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
2066 } | 2070 } |
OLD | NEW |