| 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' hide Resource; | 9 import 'dart:core' hide Resource; |
| 10 import 'dart:math' show max; | 10 import 'dart:math' show max; |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 Set<String> oldFiles = analysisServices[service]; | 944 Set<String> oldFiles = analysisServices[service]; |
| 945 Set<String> todoFiles = | 945 Set<String> todoFiles = |
| 946 oldFiles != null ? newFiles.difference(oldFiles) : newFiles; | 946 oldFiles != null ? newFiles.difference(oldFiles) : newFiles; |
| 947 for (String file in todoFiles) { | 947 for (String file in todoFiles) { |
| 948 ContextSourcePair contextSource = getContextSourcePair(file); | 948 ContextSourcePair contextSource = getContextSourcePair(file); |
| 949 // prepare context | 949 // prepare context |
| 950 AnalysisContext context = contextSource.context; | 950 AnalysisContext context = contextSource.context; |
| 951 if (context == null) { | 951 if (context == null) { |
| 952 continue; | 952 continue; |
| 953 } | 953 } |
| 954 Source source = contextSource.source; |
| 955 // Ensure that if the AST is flushed / not ready, it will be |
| 956 // computed eventually. |
| 957 if (AnalysisEngine.isDartFileName(file)) { |
| 958 (context as InternalAnalysisContext).ensureResolvedDartUnits(source); |
| 959 } |
| 960 // Send notifications that don't directly take an AST. |
| 961 switch (service) { |
| 962 case AnalysisService.NAVIGATION: |
| 963 sendAnalysisNotificationNavigation(this, context, source); |
| 964 continue; |
| 965 case AnalysisService.OCCURRENCES: |
| 966 sendAnalysisNotificationOccurrences(this, context, source); |
| 967 continue; |
| 968 } |
| 954 // Dart unit notifications. | 969 // Dart unit notifications. |
| 955 if (AnalysisEngine.isDartFileName(file)) { | 970 if (AnalysisEngine.isDartFileName(file)) { |
| 956 Source source = contextSource.source; | |
| 957 // TODO(scheglov) This way to get resolved information is very Dart | 971 // TODO(scheglov) This way to get resolved information is very Dart |
| 958 // specific. OTOH as it is planned now Angular results are not | 972 // specific. OTOH as it is planned now Angular results are not |
| 959 // flushable. | 973 // flushable. |
| 960 CompilationUnit dartUnit = | 974 CompilationUnit dartUnit = |
| 961 _getResolvedCompilationUnitToResendNotification(context, source); | 975 _getResolvedCompilationUnitToResendNotification(context, source); |
| 962 if (dartUnit != null) { | 976 if (dartUnit != null) { |
| 963 switch (service) { | 977 switch (service) { |
| 964 case AnalysisService.HIGHLIGHTS: | 978 case AnalysisService.HIGHLIGHTS: |
| 965 sendAnalysisNotificationHighlights(this, file, dartUnit); | 979 sendAnalysisNotificationHighlights(this, file, dartUnit); |
| 966 break; | 980 break; |
| 967 case AnalysisService.NAVIGATION: | |
| 968 sendAnalysisNotificationNavigation(this, context, source); | |
| 969 break; | |
| 970 case AnalysisService.OCCURRENCES: | |
| 971 sendAnalysisNotificationOccurrences(this, context, source); | |
| 972 break; | |
| 973 case AnalysisService.OUTLINE: | 981 case AnalysisService.OUTLINE: |
| 974 AnalysisContext context = dartUnit.element.context; | 982 AnalysisContext context = dartUnit.element.context; |
| 975 LineInfo lineInfo = context.getLineInfo(source); | 983 LineInfo lineInfo = context.getLineInfo(source); |
| 976 sendAnalysisNotificationOutline(this, file, lineInfo, dartUnit); | 984 sendAnalysisNotificationOutline(this, file, lineInfo, dartUnit); |
| 977 break; | 985 break; |
| 978 case AnalysisService.OVERRIDES: | 986 case AnalysisService.OVERRIDES: |
| 979 sendAnalysisNotificationOverrides(this, file, dartUnit); | 987 sendAnalysisNotificationOverrides(this, file, dartUnit); |
| 980 break; | 988 break; |
| 981 } | 989 } |
| 982 } | 990 } |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 /** | 1560 /** |
| 1553 * The [PerformanceTag] for time spent in server request handlers. | 1561 * The [PerformanceTag] for time spent in server request handlers. |
| 1554 */ | 1562 */ |
| 1555 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1563 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1556 | 1564 |
| 1557 /** | 1565 /** |
| 1558 * The [PerformanceTag] for time spent in split store microtasks. | 1566 * The [PerformanceTag] for time spent in split store microtasks. |
| 1559 */ | 1567 */ |
| 1560 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1568 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1561 } | 1569 } |
| OLD | NEW |