From 1377e006fbe8d1e22177c92662a222a96098e62d Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Fri, 8 Apr 2022 06:29:48 +0000 Subject: [PATCH] Switch analysis_server to 2.15 So, we can use constructor tear-offs :-) Change-Id: Ib819da7715e49496b01defa9dc3837bd70019134 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240642 Reviewed-by: Brian Wilkerson Commit-Queue: Konstantin Shcheglov --- .dart_tool/package_config.json | 2 +- .../lib/src/analysis_server.dart | 36 +++++++------------ pkg/analysis_server/pubspec.yaml | 2 +- .../lsp_server/integration_tests.dart | 3 +- .../support/integration_tests.dart | 5 ++- 5 files changed, 18 insertions(+), 30 deletions(-) diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index 0b5e2e4f244..765df2632c6 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -69,7 +69,7 @@ "name": "analysis_server", "rootUri": "../pkg/analysis_server", "packageUri": "lib/", - "languageVersion": "2.14" + "languageVersion": "2.15" }, { "name": "analysis_server_client", diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart index 38457b01dc0..2b8352b4487 100644 --- a/pkg/analysis_server/lib/src/analysis_server.dart +++ b/pkg/analysis_server/lib/src/analysis_server.dart @@ -85,33 +85,21 @@ class AnalysisServer extends AbstractAnalysisServer { /// A map from the name of a request to a function used to create a request /// handler. static final Map handlerGenerators = { - ANALYTICS_REQUEST_IS_ENABLED: (server, request, cancellationToken) => - AnalyticsIsEnabledHandler(server, request, cancellationToken), - ANALYTICS_REQUEST_ENABLE: (server, request, cancellationToken) => - AnalyticsEnableHandler(server, request, cancellationToken), - ANALYTICS_REQUEST_SEND_EVENT: (server, request, cancellationToken) => - AnalyticsSendEventHandler(server, request, cancellationToken), - ANALYTICS_REQUEST_SEND_TIMING: (server, request, cancellationToken) => - AnalyticsSendTimingHandler(server, request, cancellationToken), + ANALYTICS_REQUEST_IS_ENABLED: AnalyticsIsEnabledHandler.new, + ANALYTICS_REQUEST_ENABLE: AnalyticsEnableHandler.new, + ANALYTICS_REQUEST_SEND_EVENT: AnalyticsSendEventHandler.new, + ANALYTICS_REQUEST_SEND_TIMING: AnalyticsSendTimingHandler.new, // - DIAGNOSTIC_REQUEST_GET_DIAGNOSTICS: (server, request, cancellationToken) => - DiagnosticGetDiagnosticsHandler(server, request, cancellationToken), - DIAGNOSTIC_REQUEST_GET_SERVER_PORT: (server, request, cancellationToken) => - DiagnosticGetServerPortHandler(server, request, cancellationToken), + DIAGNOSTIC_REQUEST_GET_DIAGNOSTICS: DiagnosticGetDiagnosticsHandler.new, + DIAGNOSTIC_REQUEST_GET_SERVER_PORT: DiagnosticGetServerPortHandler.new, // - EXECUTION_REQUEST_CREATE_CONTEXT: (server, request, cancellationToken) => - ExecutionCreateContextHandler(server, request, cancellationToken), - EXECUTION_REQUEST_DELETE_CONTEXT: (server, request, cancellationToken) => - ExecutionDeleteContextHandler(server, request, cancellationToken), - EXECUTION_REQUEST_GET_SUGGESTIONS: (server, request, cancellationToken) => - ExecutionGetSuggestionsHandler(server, request, cancellationToken), - EXECUTION_REQUEST_MAP_URI: (server, request, cancellationToken) => - ExecutionMapUriHandler(server, request, cancellationToken), - EXECUTION_REQUEST_SET_SUBSCRIPTIONS: (server, request, cancellationToken) => - ExecutionSetSubscriptionsHandler(server, request, cancellationToken), + EXECUTION_REQUEST_CREATE_CONTEXT: ExecutionCreateContextHandler.new, + EXECUTION_REQUEST_DELETE_CONTEXT: ExecutionDeleteContextHandler.new, + EXECUTION_REQUEST_GET_SUGGESTIONS: ExecutionGetSuggestionsHandler.new, + EXECUTION_REQUEST_MAP_URI: ExecutionMapUriHandler.new, + EXECUTION_REQUEST_SET_SUBSCRIPTIONS: ExecutionSetSubscriptionsHandler.new, // - KYTHE_REQUEST_GET_KYTHE_ENTRIES: (server, request, cancellationToken) => - KytheGetKytheEntriesHandler(server, request, cancellationToken), + KYTHE_REQUEST_GET_KYTHE_ENTRIES: KytheGetKytheEntriesHandler.new, }; /// The channel from which requests are received and to which responses should diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml index 5f62d612535..e1680a0aa0d 100644 --- a/pkg/analysis_server/pubspec.yaml +++ b/pkg/analysis_server/pubspec.yaml @@ -3,7 +3,7 @@ name: analysis_server publish_to: none environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: _fe_analyzer_shared: diff --git a/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart b/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart index c09c72e6bbc..2f6f70bf0fc 100644 --- a/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart +++ b/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart @@ -150,7 +150,8 @@ class LspServerClient { var dartBinary = join(dartSdkPath, 'bin', 'dart'); - var useSnapshot = true; + // Prevent flow analysis from marking code below as being dead. + const useSnapshot = 1 > 0; String serverPath; if (useSnapshot) { diff --git a/pkg/analysis_server/test/integration/support/integration_tests.dart b/pkg/analysis_server/test/integration/support/integration_tests.dart index ceb71857cef..7c9fd4cc84d 100644 --- a/pkg/analysis_server/test/integration/support/integration_tests.dart +++ b/pkg/analysis_server/test/integration/support/integration_tests.dart @@ -622,9 +622,8 @@ class Server { var dartBinary = path.join(dartSdkPath, 'bin', 'dart'); - // The integration tests run 3x faster when run from snapshots (you need to - // run test.py with --use-sdk). - var useSnapshot = true; + // Prevent flow analysis from marking code below as being dead. + const useSnapshot = 1 > 0; String serverPath; if (useSnapshot) {