Skip to content

Commit

Permalink
Version 3.7.0-288.0.dev
Browse files Browse the repository at this point in the history
Merge ba9f351 into dev
  • Loading branch information
Dart CI committed Dec 27, 2024
2 parents 1428d38 + ba9f351 commit 0c87073
Show file tree
Hide file tree
Showing 11 changed files with 362 additions and 42 deletions.
3 changes: 2 additions & 1 deletion pkg/analysis_server/lib/src/analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ abstract class AnalysisServer {
ProcessRunner? processRunner,
this.notificationManager, {
this.requestStatistics,
bool enableBlazeWatcher = false,
// Disable to avoid using this in unit tests.
@visibleForTesting bool enableBlazeWatcher = false,
DartFixPromptManager? dartFixPromptManager,
this.providedByteStore,
PluginManager? pluginManager,
Expand Down
41 changes: 14 additions & 27 deletions pkg/analysis_server/lib/src/legacy_analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ import 'package:analysis_server/src/services/completion/completion_state.dart';
import 'package:analysis_server/src/services/execution/execution_context.dart';
import 'package:analysis_server/src/services/flutter/widget_descriptions.dart';
import 'package:analysis_server/src/services/refactoring/legacy/refactoring_manager.dart';
import 'package:analysis_server/src/services/user_prompts/dart_fix_prompt_manager.dart';
import 'package:analysis_server/src/utilities/process.dart';
import 'package:analysis_server/src/utilities/request_statistics.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
Expand Down Expand Up @@ -167,8 +165,8 @@ class AnalysisServerOptions {
}

/// Instances of the class [LegacyAnalysisServer] implement a server that
/// listens on a [CommunicationChannel] for analysis requests and processes
/// them.
/// listens on a [ServerCommunicationChannel] for analysis requests and
/// processes them.
class LegacyAnalysisServer extends AnalysisServer {
/// A map from the name of a request to a function used to create a request
/// handler.
Expand All @@ -192,19 +190,19 @@ class LegacyAnalysisServer extends AnalysisServer {
ANALYSIS_REQUEST_SET_SUBSCRIPTIONS: AnalysisSetSubscriptionsHandler.new,
ANALYSIS_REQUEST_UPDATE_CONTENT: AnalysisUpdateContentHandler.new,
ANALYSIS_REQUEST_UPDATE_OPTIONS: AnalysisUpdateOptionsHandler.new,
//

ANALYTICS_REQUEST_IS_ENABLED: AnalyticsIsEnabledHandler.new,
ANALYTICS_REQUEST_ENABLE: AnalyticsEnableHandler.new,
ANALYTICS_REQUEST_SEND_EVENT: AnalyticsSendEventHandler.new,
ANALYTICS_REQUEST_SEND_TIMING: AnalyticsSendTimingHandler.new,
//

COMPLETION_REQUEST_GET_SUGGESTION_DETAILS2:
CompletionGetSuggestionDetails2Handler.new,
COMPLETION_REQUEST_GET_SUGGESTIONS2: CompletionGetSuggestions2Handler.new,
//

DIAGNOSTIC_REQUEST_GET_DIAGNOSTICS: DiagnosticGetDiagnosticsHandler.new,
DIAGNOSTIC_REQUEST_GET_SERVER_PORT: DiagnosticGetServerPortHandler.new,
//

EDIT_REQUEST_FORMAT: EditFormatHandler.new,
EDIT_REQUEST_FORMAT_IF_ENABLED: EditFormatIfEnabledHandler.new,
EDIT_REQUEST_GET_ASSISTS: EditGetAssistsHandler.new,
Expand All @@ -223,19 +221,19 @@ class LegacyAnalysisServer extends AnalysisServer {
EDIT_REQUEST_GET_POSTFIX_COMPLETION: EditGetPostfixCompletionHandler.new,
EDIT_REQUEST_LIST_POSTFIX_COMPLETION_TEMPLATES:
EditListPostfixCompletionTemplatesHandler.new,
//

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,
//

FLUTTER_REQUEST_GET_WIDGET_DESCRIPTION:
FlutterGetWidgetDescriptionHandler.new,
FLUTTER_REQUEST_SET_WIDGET_PROPERTY_VALUE:
FlutterSetWidgetPropertyValueHandler.new,
FLUTTER_REQUEST_SET_SUBSCRIPTIONS: FlutterSetSubscriptionsHandler.new,
//

SEARCH_REQUEST_FIND_ELEMENT_REFERENCES:
SearchFindElementReferencesHandler.new,
SEARCH_REQUEST_FIND_MEMBER_DECLARATIONS:
Expand All @@ -247,15 +245,14 @@ class LegacyAnalysisServer extends AnalysisServer {
SEARCH_REQUEST_GET_ELEMENT_DECLARATIONS:
SearchGetElementDeclarationsHandler.new,
SEARCH_REQUEST_GET_TYPE_HIERARCHY: SearchGetTypeHierarchyHandler.new,
//

SERVER_REQUEST_CANCEL_REQUEST: ServerCancelRequestHandler.new,
SERVER_REQUEST_GET_VERSION: ServerGetVersionHandler.new,
SERVER_REQUEST_SET_CLIENT_CAPABILITIES:
ServerSetClientCapabilitiesHandler.new,
SERVER_REQUEST_SET_SUBSCRIPTIONS: ServerSetSubscriptionsHandler.new,
SERVER_REQUEST_SHUTDOWN: ServerShutdownHandler.new,

//
LSP_REQUEST_HANDLE: LspOverLegacyHandler.new,
};

Expand Down Expand Up @@ -364,11 +361,6 @@ class LegacyAnalysisServer extends AnalysisServer {

/// Initialize a newly created server to receive requests from and send
/// responses to the given [channel].
///
/// If [rethrowExceptions] is true, then any exceptions thrown by analysis are
/// propagated up the call stack. The default is true to allow analysis
/// exceptions to show up in unit tests, but it should be set to false when
/// running a full analysis server.
LegacyAnalysisServer(
this.channel,
ResourceProvider baseResourceProvider,
Expand All @@ -379,15 +371,14 @@ class LegacyAnalysisServer extends AnalysisServer {
InstrumentationService instrumentationService, {
http.Client? httpClient,
ProcessRunner? processRunner,
RequestStatisticsHelper? requestStatistics,
super.requestStatistics,
DiagnosticServer? diagnosticServer,
this.detachableFileSystemManager,
// Disable to avoid using this in unit tests.
bool enableBlazeWatcher = false,
DartFixPromptManager? dartFixPromptManager,
super.enableBlazeWatcher,
super.dartFixPromptManager,
super.providedByteStore,
super.pluginManager,
bool retainDataForTesting = false,
super.retainDataForTesting,
}) : lspClientConfiguration = lsp.LspClientConfiguration(
baseResourceProvider.pathContext,
),
Expand All @@ -402,10 +393,6 @@ class LegacyAnalysisServer extends AnalysisServer {
httpClient,
processRunner,
NotificationManager(channel, baseResourceProvider.pathContext),
requestStatistics: requestStatistics,
enableBlazeWatcher: enableBlazeWatcher,
dartFixPromptManager: dartFixPromptManager,
retainDataForTesting: retainDataForTesting,
) {
var contextManagerCallbacks = ServerContextManagerCallbacks(
this,
Expand Down
11 changes: 3 additions & 8 deletions pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import 'package:analysis_server/src/server/diagnostic_server.dart';
import 'package:analysis_server/src/server/error_notifier.dart';
import 'package:analysis_server/src/server/message_scheduler.dart';
import 'package:analysis_server/src/server/performance.dart';
import 'package:analysis_server/src/services/user_prompts/dart_fix_prompt_manager.dart';
import 'package:analysis_server/src/utilities/process.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/session.dart';
Expand Down Expand Up @@ -160,10 +159,9 @@ class LspAnalysisServer extends AnalysisServer {
ProcessRunner? processRunner,
DiagnosticServer? diagnosticServer,
this.detachableFileSystemManager,
// Disable to avoid using this in unit tests.
bool enableBlazeWatcher = false,
DartFixPromptManager? dartFixPromptManager,
bool retainDataForTesting = false,
super.enableBlazeWatcher,
super.dartFixPromptManager,
super.retainDataForTesting,
}) : lspClientConfiguration = LspClientConfiguration(
baseResourceProvider.pathContext,
),
Expand All @@ -178,9 +176,6 @@ class LspAnalysisServer extends AnalysisServer {
httpClient,
processRunner,
LspNotificationManager(baseResourceProvider.pathContext),
enableBlazeWatcher: enableBlazeWatcher,
dartFixPromptManager: dartFixPromptManager,
retainDataForTesting: retainDataForTesting,
) {
notificationManager.server = this;
messageHandler = UninitializedStateMessageHandler(this);
Expand Down
2 changes: 1 addition & 1 deletion runtime/bin/socket_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class SocketAddress {
char as_string_[kMaxUnixPathLength];
#else
char as_string_[INET6_ADDRSTRLEN];
#endif // defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
#endif // defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) ||
// defined(DART_HOST_OS_ANDROID)
RawAddr addr_;

Expand Down
5 changes: 4 additions & 1 deletion samples/embedder/run_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ std::string ReadSnapshot(std::string_view path) {

char* bytes = static_cast<char*>(std::malloc(length));
source_file.read(bytes, length);
return std::string(bytes, length);
auto result = std::string(bytes, length);
std::free(bytes);
return result;
}

Dart_Handle ToDartStringList(const std::vector<std::string>& values) {
Expand Down Expand Up @@ -122,6 +124,7 @@ int main(int argc, char** argv) {

// Start an isolate from a platform kernel.
Dart_IsolateFlags isolate_flags;
Dart_IsolateFlagsInitialize(&isolate_flags);

Dart_CreateIsolateGroupFromKernel(
/*script_uri=*/snapshot_uri.c_str(),
Expand Down
9 changes: 7 additions & 2 deletions sdk/lib/_http/http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,10 @@ abstract interface class HttpRequest implements Stream<Uint8List> {
/// first time, the request header is sent. Calling any methods that
/// change the header after it is sent throws an exception.
///
/// If no "Content-Type" header is set then a default of
/// "text/plain; charset=utf-8" is used and string data written to the IOSink
/// will be encoded using UTF-8.
///
/// ## Setting the headers
///
/// The HttpResponse object has a number of properties for setting up
Expand All @@ -1060,8 +1064,9 @@ abstract interface class HttpRequest implements Stream<Uint8List> {
/// response.headers.add(HttpHeaders.contentTypeHeader, "text/plain");
/// response.write(...); // Strings written will be ISO-8859-1 encoded.
///
/// An exception is thrown if you use the `write()` method
/// while an unsupported content-type is set.
/// If a charset is provided but it is not recognized, then the "Content-Type"
/// header will include that charset but string data will be encoded using
/// ISO-8859-1 (Latin 1).
abstract interface class HttpResponse implements IOSink {
// TODO(ajohnsen): Add documentation of how to pipe a file to the response.
/// Gets and sets the content length of the response. If the size of
Expand Down
2 changes: 1 addition & 1 deletion sdk/lib/_http/http_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ class _IOSinkImpl extends _StreamSinkImpl<List<int>> implements IOSink {
}

void writeln([Object? object = ""]) {
_writeString('$object\n');
write('$object\n');
}

void writeCharCode(int charCode) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Context type is propagated down in collection literals.
// Testing with constructor shorthands.

// SharedOptions=--enable-experiment=enum-shorthands

import '../enum_shorthand_helper.dart';

void main() {
var ctorList = <ConstructorClass>[
.new(1),
.regular(1),
.named(x: 1),
.optional(1),
];
var ctorSet = <ConstructorClass>{
.new(1),
.regular(1),
.named(x: 1),
.optional(1),
};
var ctorMap = <ConstructorClass, ConstructorClass>{
.new(1): .new(1),
.regular(1): .regular(1),
.named(x: 1): .named(x: 1),
.optional(1): .optional(1),
};
var ctorMap2 = <ConstructorClass, (ConstructorClass, ConstructorClass)>{
.new(1): (.new(1), .new(1)),
.regular(1): (.regular(1), .regular(1)),
.named(x: 1): (.named(x: 1), .named(x: 1)),
.optional(1): (.optional(1), .optional(1)),
};

var ctorExtList = <ConstructorExt>[
.new(1),
.regular(1),
.named(x: 1),
.optional(1),
];
var ctorExtSet = <ConstructorExt>{
.new(1),
.regular(1),
.named(x: 1),
.optional(1),
};
var ctorExtMap = <ConstructorExt, ConstructorExt>{
.new(1): .new(1),
.regular(1): .regular(1),
.named(x: 1): .named(x: 1),
.optional(1): .optional(1),
};
var ctorExtMap2 = <ConstructorExt, (ConstructorExt, ConstructorExt)>{
.new(1): (.new(1), .new(1)),
.regular(1): (.regular(1), .regular(1)),
.named(x: 1): (.named(x: 1), .named(x: 1)),
.optional(1): (.optional(1), .optional(1)),
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Context type is propagated down in collection literals.
// Testing with static method shorthands.

// SharedOptions=--enable-experiment=enum-shorthands

import '../enum_shorthand_helper.dart';

void main() {
var memberList = <StaticMember>[.member(), .memberType<String, int>('s'), .member()];
var memberSet = <StaticMember>{.member(), .memberType<String, int>('s')};
var memberMap = <StaticMember, StaticMember>{
.member(): .memberType<String, int>('s'),
.memberType<String, int>('s'): .memberType<String, int>('s'),
};
var memberMap2 = <StaticMember, (StaticMember, StaticMember)>{
.member(): (.member(), .memberType<String, int>('s')),
.memberType<String, int>('s'): (.memberType<String, int>('s'), .memberType<String, int>('s')),
};

var memberExtList = <StaticMemberExt>[
.member(),
.memberType<String, int>('s'),
.member(),
];
var memberExtSet = <StaticMemberExt>{.member(), .memberType<String, int>('s')};
var memberExtMap = <StaticMemberExt, StaticMemberExt>{
.member(): .memberType<String, int>('s'),
.memberType<String, int>('s'): .memberType<String, int>('s'),
};
var memberExtMap2 = <StaticMemberExt, (StaticMemberExt, StaticMemberExt)>{
.member(): (.member(), .memberType<String, int>('s')),
.memberType<String, int>('s'): (.memberType<String, int>('s'), .memberType<String, int>('s')),
};
}
Loading

0 comments on commit 0c87073

Please sign in to comment.