| 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 19 matching lines...) Expand all Loading... |
| 30 import 'package:analyzer/dart/ast/ast.dart'; | 30 import 'package:analyzer/dart/ast/ast.dart'; |
| 31 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 31 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 32 import 'package:analyzer/dart/element/element.dart'; | 32 import 'package:analyzer/dart/element/element.dart'; |
| 33 import 'package:analyzer/exception/exception.dart'; | 33 import 'package:analyzer/exception/exception.dart'; |
| 34 import 'package:analyzer/file_system/file_system.dart'; | 34 import 'package:analyzer/file_system/file_system.dart'; |
| 35 import 'package:analyzer/file_system/physical_file_system.dart'; | 35 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 36 import 'package:analyzer/instrumentation/instrumentation.dart'; | 36 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 37 import 'package:analyzer/plugin/resolver_provider.dart'; | 37 import 'package:analyzer/plugin/resolver_provider.dart'; |
| 38 import 'package:analyzer/source/pub_package_map_provider.dart'; | 38 import 'package:analyzer/source/pub_package_map_provider.dart'; |
| 39 import 'package:analyzer/src/context/builder.dart'; | 39 import 'package:analyzer/src/context/builder.dart'; |
| 40 import 'package:analyzer/src/dart/analysis/ast_provider_context.dart'; |
| 41 import 'package:analyzer/src/dart/analysis/ast_provider_driver.dart'; |
| 40 import 'package:analyzer/src/dart/analysis/byte_store.dart'; | 42 import 'package:analyzer/src/dart/analysis/byte_store.dart'; |
| 41 import 'package:analyzer/src/dart/analysis/driver.dart' as nd; | 43 import 'package:analyzer/src/dart/analysis/driver.dart' as nd; |
| 42 import 'package:analyzer/src/dart/analysis/file_byte_store.dart'; | 44 import 'package:analyzer/src/dart/analysis/file_byte_store.dart'; |
| 43 import 'package:analyzer/src/dart/analysis/file_state.dart' as nd; | 45 import 'package:analyzer/src/dart/analysis/file_state.dart' as nd; |
| 44 import 'package:analyzer/src/dart/analysis/status.dart' as nd; | 46 import 'package:analyzer/src/dart/analysis/status.dart' as nd; |
| 45 import 'package:analyzer/src/dart/ast/utilities.dart'; | 47 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 48 import 'package:analyzer/src/dart/element/ast_provider.dart'; |
| 46 import 'package:analyzer/src/generated/engine.dart'; | 49 import 'package:analyzer/src/generated/engine.dart'; |
| 47 import 'package:analyzer/src/generated/sdk.dart'; | 50 import 'package:analyzer/src/generated/sdk.dart'; |
| 48 import 'package:analyzer/src/generated/source.dart'; | 51 import 'package:analyzer/src/generated/source.dart'; |
| 49 import 'package:analyzer/src/generated/source_io.dart'; | 52 import 'package:analyzer/src/generated/source_io.dart'; |
| 50 import 'package:analyzer/src/generated/utilities_general.dart'; | 53 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 51 import 'package:analyzer/src/summary/pub_summary.dart'; | 54 import 'package:analyzer/src/summary/pub_summary.dart'; |
| 52 import 'package:analyzer/src/task/dart.dart'; | 55 import 'package:analyzer/src/task/dart.dart'; |
| 53 import 'package:analyzer/src/util/glob.dart'; | 56 import 'package:analyzer/src/util/glob.dart'; |
| 54 import 'package:analyzer/task/dart.dart'; | 57 import 'package:analyzer/task/dart.dart'; |
| 55 import 'package:plugin/plugin.dart'; | 58 import 'package:plugin/plugin.dart'; |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 channel.sendNotification(notification); | 1111 channel.sendNotification(notification); |
| 1109 } | 1112 } |
| 1110 | 1113 |
| 1111 /** | 1114 /** |
| 1112 * Send the given [response] to the client. | 1115 * Send the given [response] to the client. |
| 1113 */ | 1116 */ |
| 1114 void sendResponse(Response response) { | 1117 void sendResponse(Response response) { |
| 1115 channel.sendResponse(response); | 1118 channel.sendResponse(response); |
| 1116 } | 1119 } |
| 1117 | 1120 |
| 1121 AstProvider getAstProvider(String path) { |
| 1122 if (options.enableNewAnalysisDriver) { |
| 1123 var analysisDriver = getAnalysisDriver(path); |
| 1124 return new AstProviderForDriver(analysisDriver); |
| 1125 } else { |
| 1126 var analysisContext = getAnalysisContext(path); |
| 1127 return new AstProviderForContext(analysisContext); |
| 1128 } |
| 1129 } |
| 1130 |
| 1118 /** | 1131 /** |
| 1119 * Sends a `server.error` notification. | 1132 * Sends a `server.error` notification. |
| 1120 */ | 1133 */ |
| 1121 void sendServerErrorNotification(String message, exception, stackTrace, | 1134 void sendServerErrorNotification(String message, exception, stackTrace, |
| 1122 {bool fatal: false}) { | 1135 {bool fatal: false}) { |
| 1123 StringBuffer buffer = new StringBuffer(); | 1136 StringBuffer buffer = new StringBuffer(); |
| 1124 if (exception != null) { | 1137 if (exception != null) { |
| 1125 buffer.write(exception); | 1138 buffer.write(exception); |
| 1126 } else { | 1139 } else { |
| 1127 buffer.write('null exception'); | 1140 buffer.write('null exception'); |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 /** | 2124 /** |
| 2112 * The [PerformanceTag] for time spent in server request handlers. | 2125 * The [PerformanceTag] for time spent in server request handlers. |
| 2113 */ | 2126 */ |
| 2114 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2127 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 2115 | 2128 |
| 2116 /** | 2129 /** |
| 2117 * The [PerformanceTag] for time spent in split store microtasks. | 2130 * The [PerformanceTag] for time spent in split store microtasks. |
| 2118 */ | 2131 */ |
| 2119 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2132 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 2120 } | 2133 } |
| OLD | NEW |