Version 2.18.0-158.0.dev
Merge commit '1e7bc687a7931c7bd837147b6fef60b9cf4fa42c' into 'dev'
diff --git a/DEPS b/DEPS
index 41f4b08..cc10c05 100644
--- a/DEPS
+++ b/DEPS
@@ -90,7 +90,7 @@
"cli_util_rev": "b0adbba89442b2ea6fef39c7a82fe79cb31e1168",
"clock_rev": "f594d86da123015186d5680b0d0e8255c52fc162",
"collection_rev": "e1407da23b9f17400b3a905aafe2b8fa10db3d86",
- "convert_rev": "e063fdca4bebffecbb5e6aa5525995120982d9ce",
+ "convert_rev": "00b251529c074df394b3391c7e3eea3dd9e5778e",
"crypto_rev": "4297d240b0e1e780ec0a9eab23eaf1ad491f3e68",
"csslib_rev": "518761b166974537f334dbf264e7f56cb157a96a",
diff --git a/pkg/analysis_server/lib/src/analysis_server_abstract.dart b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
index 05bdf23..5189728 100644
--- a/pkg/analysis_server/lib/src/analysis_server_abstract.dart
+++ b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
@@ -534,6 +534,11 @@
@mustCallSuper
void shutdown() {
+ // For now we record plugins only on shutdown. We might want to record them
+ // every time the set of plugins changes, in which case we'll need to listen
+ // to the `PluginManager.pluginsChanged` stream.
+ analyticsManager.changedPlugins(pluginManager);
+
pubPackageService.shutdown();
analyticsManager.shutdown();
}
diff --git a/pkg/analysis_server/lib/src/analytics/analytics_manager.dart b/pkg/analysis_server/lib/src/analytics/analytics_manager.dart
index 125c1c2..12fb6cb 100644
--- a/pkg/analysis_server/lib/src/analytics/analytics_manager.dart
+++ b/pkg/analysis_server/lib/src/analytics/analytics_manager.dart
@@ -5,6 +5,7 @@
import 'package:analysis_server/lsp_protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/src/analytics/google_analytics_manager.dart';
+import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:telemetry/telemetry.dart';
/// An interface for managing and reporting analytics.
@@ -19,6 +20,9 @@
factory AnalyticsManager.forAnalytics(Analytics analytics) =
GoogleAnalyticsManager;
+ /// Record that the set of plugins known to the [pluginManager] has changed.
+ void changedPlugins(PluginManager pluginManager);
+
/// Record that the given [response] was sent to the client.
void sentResponse({required Response response});
diff --git a/pkg/analysis_server/lib/src/analytics/google_analytics_manager.dart b/pkg/analysis_server/lib/src/analytics/google_analytics_manager.dart
index cf3b4b1..95b14ff 100644
--- a/pkg/analysis_server/lib/src/analytics/google_analytics_manager.dart
+++ b/pkg/analysis_server/lib/src/analytics/google_analytics_manager.dart
@@ -2,10 +2,13 @@
// 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.
+import 'dart:convert';
+
import 'package:analysis_server/lsp_protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/src/analytics/analytics_manager.dart';
import 'package:analysis_server/src/analytics/percentile_calculator.dart';
+import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:telemetry/telemetry.dart';
/// An implementation of [AnalyticsManager] that's appropriate to use when
@@ -18,6 +21,8 @@
/// been invoked.
_SessionData? _sessionData;
+ final _PluginData _pluginData = _PluginData();
+
/// A map from the id of a request to data about the request.
final Map<String, _ActiveRequestData> _activeRequests = {};
@@ -30,6 +35,11 @@
GoogleAnalyticsManager(this.analytics);
@override
+ void changedPlugins(PluginManager pluginManager) {
+ _pluginData.recordPlugins(pluginManager);
+ }
+
+ @override
void sentResponse({required Response response}) {
var sendTime = DateTime.now();
_recordResponseData(response.id, sendTime);
@@ -59,10 +69,7 @@
'clientId': sessionData.clientId,
'sdkVersion': sessionData.sdkVersion,
'duration': duration.toString(),
- // TODO(brianwilkerson) Report a list of the names of the plugins that
- // were loaded, or possibly a map from plugin names to the number of
- // analysis roots in which the plugins were loaded.
- 'plugins': '',
+ 'plugins': _pluginData.usageCountData,
});
// Send response data.
for (var data in _completedRequests.values) {
@@ -148,6 +155,48 @@
_ActiveRequestData(this.requestName, this.clientRequestTime, this.startTime);
}
+/// Data about the plugins associated with the context roots.
+class _PluginData {
+ /// The number of times that plugin information has been recorded.
+ int recordCount = 0;
+
+ /// A table mapping the ids of running plugins to the number of context roots
+ /// associated with each of the plugins.
+ Map<String, PercentileCalculator> usageCounts = {};
+
+ /// Initialize a newly created holder of plugin data.
+ _PluginData();
+
+ String get usageCountData {
+ return json.encode({
+ 'recordCount': recordCount,
+ 'rootCounts': _encodeUsageCounts(),
+ });
+ }
+
+ /// Use the [pluginManager] to record data about the plugins that are
+ /// currently running.
+ void recordPlugins(PluginManager pluginManager) {
+ recordCount++;
+ var plugins = pluginManager.plugins;
+ for (var i = 0; i < plugins.length; i++) {
+ var info = plugins[i];
+ usageCounts
+ .putIfAbsent(info.pluginId, () => PercentileCalculator())
+ .addValue(info.contextRoots.length);
+ }
+ }
+
+ /// Return an encoding of the [usageCounts].
+ Map<String, String> _encodeUsageCounts() {
+ var encoded = <String, String>{};
+ for (var entry in usageCounts.entries) {
+ encoded[entry.key] = entry.value.toAnalyticsString();
+ }
+ return encoded;
+ }
+}
+
/// Data about the requests that have been responded to that have the same name.
class _RequestData {
/// The name of the requests.
diff --git a/pkg/analysis_server/lib/src/analytics/noop_analytics_manager.dart b/pkg/analysis_server/lib/src/analytics/noop_analytics_manager.dart
index 36f46a5..d52e59d 100644
--- a/pkg/analysis_server/lib/src/analytics/noop_analytics_manager.dart
+++ b/pkg/analysis_server/lib/src/analytics/noop_analytics_manager.dart
@@ -5,11 +5,15 @@
import 'package:analysis_server/lsp_protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/src/analytics/analytics_manager.dart';
+import 'package:analysis_server/src/plugin/plugin_manager.dart';
/// An implementation of [AnalyticsManager] that's appropriate to use when
/// analytics have not been enabled.
class NoopAnalyticsManager implements AnalyticsManager {
@override
+ void changedPlugins(PluginManager pluginManager) {}
+
+ @override
void sentResponse({required Response response}) {}
@override
diff --git a/pkg/analysis_server_client/README.md b/pkg/analysis_server_client/README.md
index c4cc469..7ae141c 100644
--- a/pkg/analysis_server_client/README.md
+++ b/pkg/analysis_server_client/README.md
@@ -1,6 +1,7 @@
-# analysis_server_client
+[![pub package](https://img.shields.io/pub/v/analysis_server_client.svg)](https://pub.dev/packages/analysis_server_client)
+[![package publisher](https://img.shields.io/pub/publisher/analysis_server_client.svg)](https://pub.dev/packages/analysis_server_client/publisher)
-analysis_server_client is a client wrapper over Analysis Server.
+`package:analysis_server_client` is a client wrapper over the Analysis Server.
## Overview
diff --git a/pkg/analyzer/README.md b/pkg/analyzer/README.md
index 6f5102e..e1bcdad 100644
--- a/pkg/analyzer/README.md
+++ b/pkg/analyzer/README.md
@@ -1,4 +1,5 @@
-# Analyzer for Dart
+[![pub package](https://img.shields.io/pub/v/analyzer.svg)](https://pub.dev/packages/analyzer)
+[![package publisher](https://img.shields.io/pub/publisher/analyzer.svg)](https://pub.dev/packages/analyzer/publisher)
This package provides a library that performs static analysis
of Dart code. It is useful for tool integration and embedding.
diff --git a/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart b/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
index 98d9538..adb53ee 100644
--- a/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
@@ -19,6 +19,7 @@
correctionMessage:
"Try removing all type parameters, removing all members, and adding "
"one const constructor.",
+ hasPublishedDocs: true,
);
/// No parameters.
@@ -28,6 +29,7 @@
"'AbiSpecificIntegerMapping' annotation specifying the mapping from "
"ABI to a 'NativeType' integer with a fixed size.",
correctionMessage: "Try removing the extra annotation.",
+ hasPublishedDocs: true,
);
/// No parameters.
@@ -37,6 +39,7 @@
"'AbiSpecificIntegerMapping' annotation specifying the mapping from "
"ABI to a 'NativeType' integer with a fixed size.",
correctionMessage: "Try adding an annotation.",
+ hasPublishedDocs: true,
);
/// No parameters.
@@ -47,6 +50,7 @@
correctionMessage:
"Try changing the value to 'Int8', 'Int16', 'Int32', 'Int64', 'Uint8', "
"'Uint16', 'UInt32', or 'Uint64'.",
+ hasPublishedDocs: true,
);
/// No parameters.
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
index cfccb2c..4d4efcf 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
@@ -187,6 +187,7 @@
"The operator x ~/ y is more efficient than (x / y).toInt().",
correctionMessage:
"Try re-writing the expression to use the '~/' operator.",
+ hasPublishedDocs: true,
);
/// No parameters.
@@ -543,6 +544,7 @@
"The annotation '@nonVirtual' can only be applied to a concrete instance "
"member.",
correctionMessage: "Try removing '@nonVirtual'.",
+ hasPublishedDocs: true,
);
/// This hint is generated anywhere where an instance member annotated with
@@ -555,6 +557,7 @@
'INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER',
"The member '{0}' is declared non-virtual in '{1}' and can't be overridden "
"in subclasses.",
+ hasPublishedDocs: true,
);
/// This hint is generated anywhere where `@required` annotates a named
@@ -601,6 +604,7 @@
'INVALID_SEALED_ANNOTATION',
"The annotation '@sealed' can only be applied to classes.",
correctionMessage: "Try removing the '@sealed' annotation.",
+ hasPublishedDocs: true,
);
/// Parameters:
@@ -651,6 +655,7 @@
static const HintCode INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER = HintCode(
'INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER',
"The member '{0}' can only be used within '{1}' or a test.",
+ hasPublishedDocs: true,
);
/// This hint is generated anywhere where a private declaration is annotated
@@ -1177,6 +1182,7 @@
"The keyword 'final' isn't necessary because the parameter is implicitly "
"'final'.",
correctionMessage: "Try removing the 'final'.",
+ hasPublishedDocs: true,
);
/// Parameters:
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index 7410c77..b725ca4 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -2762,6 +2762,7 @@
'MIXIN_SUPER_CLASS_CONSTRAINT_DEFERRED_CLASS',
"Deferred classes can't be used as superclass constraints.",
correctionMessage: "Try changing the import to not be deferred.",
+ hasPublishedDocs: true,
);
/// Parameters:
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index 16b3fff..ba11178d 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -8717,6 +8717,7 @@
MIXIN_SUPER_CLASS_CONSTRAINT_DEFERRED_CLASS:
problemMessage: "Deferred classes can't be used as superclass constraints."
correctionMessage: Try changing the import to not be deferred.
+ hasPublishedDocs: true
comment: No parameters.
documentation: |-
#### Description
@@ -15641,6 +15642,7 @@
ABI_SPECIFIC_INTEGER_INVALID:
problemMessage: "Classes extending 'AbiSpecificInteger' must have exactly one const constructor, no other members, and no type parameters."
correctionMessage: Try removing all type parameters, removing all members, and adding one const constructor.
+ hasPublishedDocs: true
comment: No parameters.
documentation: |-
#### Description
@@ -15732,6 +15734,7 @@
ABI_SPECIFIC_INTEGER_MAPPING_EXTRA:
problemMessage: "Classes extending 'AbiSpecificInteger' must have exactly one 'AbiSpecificIntegerMapping' annotation specifying the mapping from ABI to a 'NativeType' integer with a fixed size."
correctionMessage: Try removing the extra annotation.
+ hasPublishedDocs: true
comment: No parameters.
documentation: |-
#### Description
@@ -15771,6 +15774,7 @@
ABI_SPECIFIC_INTEGER_MAPPING_MISSING:
problemMessage: "Classes extending 'AbiSpecificInteger' must have exactly one 'AbiSpecificIntegerMapping' annotation specifying the mapping from ABI to a 'NativeType' integer with a fixed size."
correctionMessage: Try adding an annotation.
+ hasPublishedDocs: true
comment: No parameters.
documentation: |-
#### Description
@@ -15807,6 +15811,7 @@
ABI_SPECIFIC_INTEGER_MAPPING_UNSUPPORTED:
problemMessage: "Only mappings to 'Int8', 'Int16', 'Int32', 'Int64', 'Uint8', 'Uint16', 'UInt32', and 'Uint64' are supported."
correctionMessage: Try changing the value to 'Int8', 'Int16', 'Int32', 'Int64', 'Uint8', 'Uint16', 'UInt32', or 'Uint64'.
+ hasPublishedDocs: true
comment: No parameters.
documentation: |-
#### Description
@@ -15861,7 +15866,7 @@
subclass of `Struct` and has the type `Pointer` also has an annotation
associated with it.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -15906,7 +15911,7 @@
The analyzer also produces this diagnostic when the value of the
`exceptionalReturn` argument of `Pointer.fromFunction`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -15960,7 +15965,7 @@
The analyzer produces this diagnostic when a subclass of either `Struct`
or `Union` implements `Finalizable`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -15997,7 +16002,7 @@
The analyzer produces this diagnostic when a subclass of either `Struct`
or `Union` is instantiated using a generative constructor.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16053,7 +16058,7 @@
`Union` doesn't have any fields. Having an empty `Struct` or `Union`
isn't supported.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16106,7 +16111,7 @@
`Struct` has more than one annotation describing the native type of the
field.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16146,7 +16151,7 @@
`Struct` has more than one annotation describing the size of the native
array.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16208,7 +16213,7 @@
The analyzer produces this diagnostic when a constructor in a subclass of
either `Struct` or `Union` has one or more field initializers.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16253,7 +16258,7 @@
The analyzer produces this diagnostic when a field in a subclass of
`Struct` has an initializer.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16292,7 +16297,7 @@
The analyzer produces this diagnostic when a field in a subclass of either
`Struct` or `Union` isn't marked as being `external`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16333,7 +16338,7 @@
The analyzer produces this diagnostic when a subclass of either `Struct`
or `Union` has a type parameter.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16372,7 +16377,7 @@
value) and the type to be returned from the invocation is either `void`,
`Handle` or `Pointer`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16420,7 +16425,7 @@
`Struct` has a type other than `int`, `double`, `Array`, `Pointer`, or
subtype of `Struct` or `Union`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16474,7 +16479,7 @@
In all of these cases, leaf calls are only supported for the types `bool`,
`int`, `float`, `double`, and, as a return type `void`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16524,7 +16529,7 @@
`DynamicLibrary.lookupFunction` is `true` and the function that would be
returned would have a parameter of type `Handle`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16573,7 +16578,7 @@
The analyzer produces this diagnostic when the annotation on a field in a
subclass of `Struct` or `Union` doesn't match the Dart type of the field.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16629,7 +16634,7 @@
C types, and the annotation specifies which of the compatible C types the
field represents.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16669,7 +16674,7 @@
return value) when the type to be returned from the invocation is neither
`void`, `Handle`, nor `Pointer`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16715,7 +16720,7 @@
an explicit type, and the type must either be `int`, `double`, `Pointer`,
or a subclass of either `Struct` or `Union`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16760,7 +16765,7 @@
`Struct` or `Union` has a type of `Array` but doesn't have a single
`Array` annotation indicating the dimensions of the array.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16802,7 +16807,7 @@
`Pointer.fromFunction` or `DynamicLibrary.lookupFunction` has a type
argument(whether explicit or inferred) that isn't a native function type.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16856,7 +16861,7 @@
- In an invocation of `DynamicLibrary.lookupFunction` where the first type
argument isn't a supertype of the second type argument.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16919,7 +16924,7 @@
are required to be known at compile time, but a type parameter, whose
value can't be known at compile time, is used as a type argument.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16967,7 +16972,7 @@
invoked on a pointer to a native function, but the signature of the native
function isn't a valid C function signature.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17015,7 +17020,7 @@
The analyzer produces this diagnostic when a dimension given in an `Array`
annotation is less than or equal to zero (`0`).
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17058,7 +17063,7 @@
`Double`, `Pointer`, or subtype of `Struct`, `Union`, or
`AbiSpecificInteger`.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17097,7 +17102,7 @@
The analyzer produces this diagnostic when a subclass of `Struct` has more
than one `Packed` annotation.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17137,7 +17142,7 @@
The analyzer produces this diagnostic when the argument to the `Packed`
annotation isn't one of the allowed values: 1, 2, 4, 8, or 16.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17181,7 +17186,7 @@
of `Struct` and the field's type is either not packed or is packed less
tightly.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17262,7 +17267,7 @@
specified in an `Array` annotation doesn't match the number of nested
arrays specified by the type of a field.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17320,7 +17325,7 @@
`Struct` and `Union` are the only FFI classes that can be subtyped, and
then only by extending them.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17387,7 +17392,7 @@
mixes in a class that extends either `Struct` or `Union`. Classes can only
extend either `Struct` or `Union` directly.
- For more information about FFI, see [C interop using dart:ffi][].
+ For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -17929,6 +17934,7 @@
DIVISION_OPTIMIZATION:
problemMessage: The operator x ~/ y is more efficient than (x / y).toInt().
correctionMessage: "Try re-writing the expression to use the '~/' operator."
+ hasPublishedDocs: true
comment: No parameters.
documentation: |-
#### Description
@@ -18810,6 +18816,7 @@
INVALID_NON_VIRTUAL_ANNOTATION:
problemMessage: "The annotation '@nonVirtual' can only be applied to a concrete instance member."
correctionMessage: Try removing '@nonVirtual'.
+ hasPublishedDocs: true
comment: |-
This hint is generated anywhere where `@nonVirtual` annotates something
other than a non-abstract instance member in a class or mixin.
@@ -18889,6 +18896,7 @@
```
INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER:
problemMessage: "The member '{0}' is declared non-virtual in '{1}' and can't be overridden in subclasses."
+ hasPublishedDocs: true
comment: |-
This hint is generated anywhere where an instance member annotated with
`@nonVirtual` is overridden in a subclass.
@@ -19048,6 +19056,7 @@
INVALID_SEALED_ANNOTATION:
problemMessage: "The annotation '@sealed' can only be applied to classes."
correctionMessage: Try removing the '@sealed' annotation.
+ hasPublishedDocs: true
comment: |-
This hint is generated anywhere where `@sealed` annotates something other
than a class.
@@ -19185,6 +19194,7 @@
1: the name of the defining class
INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER:
problemMessage: "The member '{0}' can only be used within '{1}' or a test."
+ hasPublishedDocs: true
comment: |-
This hint is generated anywhere where a member annotated with
`@visibleForTesting` is used outside the defining library, or a test.
@@ -20899,7 +20909,7 @@
UNNECESSARY_FINAL:
problemMessage: The keyword 'final' isn't necessary because the parameter is implicitly 'final'.
correctionMessage: Try removing the 'final'.
- hasPublishedDocs: false
+ hasPublishedDocs: true
comment: No parameters.
documentation: |-
#### Description
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index 14ab1b7..17e8bb1e 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -283,6 +283,7 @@
doesn't conform to the language specification or
that might work in unexpected ways.
+[ffi]: https://dart.dev/guides/libraries/c-interop
[meta-doNotStore]: https://pub.dev/documentation/meta/latest/meta/doNotStore-constant.html
[meta-factory]: https://pub.dev/documentation/meta/latest/meta/factory-constant.html
[meta-immutable]: https://pub.dev/documentation/meta/latest/meta/immutable-constant.html
@@ -901,7 +902,7 @@
subclass of `Struct` and has the type `Pointer` also has an annotation
associated with it.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -943,7 +944,7 @@
The analyzer also produces this diagnostic when the value of the
`exceptionalReturn` argument of `Pointer.fromFunction`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -2216,7 +2217,7 @@
The analyzer produces this diagnostic when a subclass of either `Struct`
or `Union` implements `Finalizable`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -3233,7 +3234,7 @@
The analyzer produces this diagnostic when a subclass of either `Struct`
or `Union` is instantiated using a generative constructor.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -4486,7 +4487,7 @@
`Union` doesn't have any fields. Having an empty `Struct` or `Union`
isn't supported.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -5544,7 +5545,7 @@
`Struct` has more than one annotation describing the native type of the
field.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -5660,7 +5661,7 @@
`Struct` has more than one annotation describing the size of the native
array.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -5875,7 +5876,7 @@
The analyzer produces this diagnostic when a constructor in a subclass of
either `Struct` or `Union` has one or more field initializers.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -6140,7 +6141,7 @@
The analyzer produces this diagnostic when a field in a subclass of
`Struct` has an initializer.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -6178,7 +6179,7 @@
The analyzer produces this diagnostic when a field in a subclass of either
`Struct` or `Union` isn't marked as being `external`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -6604,7 +6605,7 @@
The analyzer produces this diagnostic when a subclass of either `Struct`
or `Union` has a type parameter.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -8193,7 +8194,7 @@
value) and the type to be returned from the invocation is either `void`,
`Handle` or `Pointer`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -8516,7 +8517,7 @@
`Struct` has a type other than `int`, `double`, `Array`, `Pointer`, or
subtype of `Struct` or `Union`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -10154,7 +10155,7 @@
In all of these cases, leaf calls are only supported for the types `bool`,
`int`, `float`, `double`, and, as a return type `void`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -10203,7 +10204,7 @@
`DynamicLibrary.lookupFunction` is `true` and the function that would be
returned would have a parameter of type `Handle`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -10530,7 +10531,7 @@
The analyzer produces this diagnostic when the annotation on a field in a
subclass of `Struct` or `Union` doesn't match the Dart type of the field.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -10583,7 +10584,7 @@
C types, and the annotation specifies which of the compatible C types the
field represents.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -10754,7 +10755,7 @@
return value) when the type to be returned from the invocation is neither
`void`, `Handle`, nor `Pointer`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -10798,7 +10799,7 @@
an explicit type, and the type must either be `int`, `double`, `Pointer`,
or a subclass of either `Struct` or `Union`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -10973,7 +10974,7 @@
`Struct` or `Union` has a type of `Array` but doesn't have a single
`Array` annotation indicating the dimensions of the array.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -11614,7 +11615,7 @@
`Pointer.fromFunction` or `DynamicLibrary.lookupFunction` has a type
argument(whether explicit or inferred) that isn't a native function type.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -11663,7 +11664,7 @@
- In an invocation of `DynamicLibrary.lookupFunction` where the first type
argument isn't a supertype of the second type argument.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -12544,7 +12545,7 @@
are required to be known at compile time, but a type parameter, whose
value can't be known at compile time, is used as a type argument.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -12825,7 +12826,7 @@
invoked on a pointer to a native function, but the signature of the native
function isn't a valid C function signature.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -12872,7 +12873,7 @@
The analyzer produces this diagnostic when a dimension given in an `Array`
annotation is less than or equal to zero (`0`).
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -12913,7 +12914,7 @@
`Double`, `Pointer`, or subtype of `Struct`, `Union`, or
`AbiSpecificInteger`.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -14048,7 +14049,7 @@
The analyzer produces this diagnostic when a subclass of `Struct` has more
than one `Packed` annotation.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -14087,7 +14088,7 @@
The analyzer produces this diagnostic when the argument to the `Packed`
annotation isn't one of the allowed values: 1, 2, 4, 8, or 16.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -14128,7 +14129,7 @@
of `Struct` and the field's type is either not packed or is packed less
tightly.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16393,7 +16394,7 @@
specified in an `Array` annotation doesn't match the number of nested
arrays specified by the type of a field.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16613,7 +16614,7 @@
`Struct` and `Union` are the only FFI classes that can be subtyped, and
then only by extending them.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
@@ -16715,7 +16716,7 @@
mixes in a class that extends either `Struct` or `Union`. Classes can only
extend either `Struct` or `Union` directly.
-For more information about FFI, see [C interop using dart:ffi][].
+For more information about FFI, see [C interop using dart:ffi][ffi].
#### Example
diff --git a/pkg/analyzer/tool/diagnostics/generate.dart b/pkg/analyzer/tool/diagnostics/generate.dart
index f326cd70..f2a462b 100644
--- a/pkg/analyzer/tool/diagnostics/generate.dart
+++ b/pkg/analyzer/tool/diagnostics/generate.dart
@@ -192,6 +192,7 @@
doesn't conform to the language specification or
that might work in unexpected ways.
+[ffi]: https://dart.dev/guides/libraries/c-interop
[meta-doNotStore]: https://pub.dev/documentation/meta/latest/meta/doNotStore-constant.html
[meta-factory]: https://pub.dev/documentation/meta/latest/meta/factory-constant.html
[meta-immutable]: https://pub.dev/documentation/meta/latest/meta/immutable-constant.html
diff --git a/pkg/analyzer_plugin/README.md b/pkg/analyzer_plugin/README.md
index 55fa2fa..ef7af1b 100644
--- a/pkg/analyzer_plugin/README.md
+++ b/pkg/analyzer_plugin/README.md
@@ -1,4 +1,5 @@
-# analyzer_plugin
+[![pub package](https://img.shields.io/pub/v/analyzer_plugin.svg)](https://pub.dev/packages/analyzer_plugin)
+[![package publisher](https://img.shields.io/pub/publisher/analyzer_plugin.svg)](https://pub.dev/packages/analyzer_plugin/publisher)
A framework for building plugins for the analysis server.
diff --git a/pkg/dart2js_info/lib/deferred_library_check.dart b/pkg/dart2js_info/lib/deferred_library_check.dart
index 111cb10..07d53dc 100644
--- a/pkg/dart2js_info/lib/deferred_library_check.dart
+++ b/pkg/dart2js_info/lib/deferred_library_check.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.11
-
/// This tool checks that the output from dart2js meets a given specification,
/// given in a YAML file. The format of the YAML file is:
///
@@ -96,14 +94,14 @@
var packageName = _getPackageName(lib.uri);
if (!mentionedPackages.contains(packageName)) return;
var containingParts = <String>[];
- if (info.outputUnit.name == 'main') {
+ if (info.outputUnit!.name == 'main') {
containingParts.add('main');
} else {
- containingParts.addAll(info.outputUnit.imports);
+ containingParts.addAll(info.outputUnit!.imports);
}
for (var part in containingParts) {
(actualIncludedPackages[part] ??= {}).add(packageName);
- if (excludedPackages[part].contains(packageName)) {
+ if (excludedPackages[part]!.contains(packageName)) {
failures.add(_PartContainedExcludedPackage(part, packageName, info));
}
}
@@ -116,7 +114,7 @@
includedPackages.forEach((part, packages) {
for (var package in packages) {
if (!actualIncludedPackages.containsKey(part) ||
- !actualIncludedPackages[part].contains(package)) {
+ !actualIncludedPackages[part]!.contains(package)) {
failures.add(_PartDidNotContainPackage(part, package));
}
}
@@ -124,8 +122,8 @@
return failures;
}
-LibraryInfo _getLibraryOf(Info info) {
- var current = info;
+LibraryInfo? _getLibraryOf(Info info) {
+ Info? current = info;
while (current is! LibraryInfo) {
if (current == null) {
return null;
diff --git a/pkg/dart2js_info/lib/src/common_element.dart b/pkg/dart2js_info/lib/src/common_element.dart
index c2b94e5..ff3c055 100644
--- a/pkg/dart2js_info/lib/src/common_element.dart
+++ b/pkg/dart2js_info/lib/src/common_element.dart
@@ -1,5 +1,3 @@
-// @dart = 2.11
-
import 'package:dart2js_info/info.dart';
import 'package:dart2js_info/src/util.dart';
@@ -22,7 +20,7 @@
final AllInfo _old;
final AllInfo _new;
- BasicInfo _other;
+ late BasicInfo _other;
List<CommonElement> commonElements = <CommonElement>[];
@@ -110,7 +108,7 @@
for (var oldInfo in oldInfos) {
var oldName = longName(oldInfo, useLibraryUri: true);
if (newNames.containsKey(oldName)) {
- _other = newNames[oldName];
+ _other = newNames[oldName]!;
oldInfo.accept(this);
}
}
diff --git a/pkg/dart2js_info/lib/src/diff.dart b/pkg/dart2js_info/lib/src/diff.dart
index 4093dac..bcd6431 100644
--- a/pkg/dart2js_info/lib/src/diff.dart
+++ b/pkg/dart2js_info/lib/src/diff.dart
@@ -1,5 +1,3 @@
-// @dart = 2.11
-
import 'package:dart2js_info/info.dart';
import 'package:dart2js_info/src/util.dart';
@@ -40,7 +38,7 @@
final AllInfo _old;
final AllInfo _new;
- BasicInfo _other;
+ BasicInfo? _other;
List<Diff> diffs = <Diff>[];
@@ -142,10 +140,8 @@
}
bool _isDeferred(BasicInfo info) {
- var outputUnit = info.outputUnit;
- return outputUnit.name != null &&
- outputUnit.name.isNotEmpty &&
- outputUnit.name != 'main';
+ var outputUnit = info.outputUnit!;
+ return outputUnit.name.isNotEmpty && outputUnit.name != 'main';
}
void _diffList(List<BasicInfo> oldInfos, List<BasicInfo> newInfos) {
@@ -159,15 +155,15 @@
}
for (var oldName in oldNames.keys) {
if (newNames[oldName] == null) {
- diffs.add(RemoveDiff(oldNames[oldName]));
+ diffs.add(RemoveDiff(oldNames[oldName]!));
} else {
_other = newNames[oldName];
- oldNames[oldName].accept(this);
+ oldNames[oldName]!.accept(this);
}
}
for (var newName in newNames.keys) {
if (oldNames[newName] == null) {
- diffs.add(AddDiff(newNames[newName]));
+ diffs.add(AddDiff(newNames[newName]!));
}
}
}
diff --git a/pkg/dart2js_info/lib/src/string_edit_buffer.dart b/pkg/dart2js_info/lib/src/string_edit_buffer.dart
index 4f552c0..35257df 100644
--- a/pkg/dart2js_info/lib/src/string_edit_buffer.dart
+++ b/pkg/dart2js_info/lib/src/string_edit_buffer.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.11
-
/// Defines [StringEditBuffer], a buffer that can be used to apply edits on a
/// string.
// TODO(sigmund): this should move to a separate package.
@@ -24,7 +22,7 @@
/// Edit the original text, replacing text on the range [begin] and
/// exclusive [end] with the [replacement] string.
- void replace(int begin, int end, String replacement, [int sortId]) {
+ void replace(int begin, int end, String replacement, [int? sortId]) {
_edits.add(_StringEdit(begin, end, replacement, sortId));
}
@@ -97,7 +95,7 @@
// String to insert
final String string;
- _StringEdit(this.begin, this.end, this.string, [int sortId])
+ _StringEdit(this.begin, this.end, this.string, [int? sortId])
: sortId = sortId ?? begin;
int get length => end - begin;
diff --git a/pkg/dart2js_info/lib/src/table.dart b/pkg/dart2js_info/lib/src/table.dart
index b092ec8..40a205a 100644
--- a/pkg/dart2js_info/lib/src/table.dart
+++ b/pkg/dart2js_info/lib/src/table.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.11
-
library dart2js_info.src.table;
import 'dart:math' show max;
@@ -37,7 +35,7 @@
bool _sealed = false;
/// Current row being built by [addEntry].
- List _currentRow;
+ List? _currentRow;
/// Add a column with the given [name].
void declareColumn(String name,
@@ -67,17 +65,17 @@
_sealed = true;
_currentRow = [];
}
- int pos = _currentRow.length;
+ int pos = _currentRow!.length;
assert(pos < _totalColumns);
widths[pos] = max(widths[pos], '$entry'.length + 1);
- _currentRow.add('$entry');
+ _currentRow!.add('$entry');
if (entry is int && entry != 0) {
_skipped[pos] = false;
}
if (pos + 1 == _totalColumns) {
- rows.add(_currentRow);
+ rows.add(_currentRow!);
_currentRow = [];
}
}
diff --git a/pkg/dart2js_info/lib/src/util.dart b/pkg/dart2js_info/lib/src/util.dart
index ec8245a..f509ea6 100644
--- a/pkg/dart2js_info/lib/src/util.dart
+++ b/pkg/dart2js_info/lib/src/util.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.11
-
library dart2js_info.src.util;
import 'package:dart2js_info/info.dart';
@@ -26,8 +24,9 @@
for (var g in f.uses) {
graph.addEdge(f, g.target);
}
- if (info.dependencies[f] != null) {
- for (var g in info.dependencies[f]) {
+ final dependencies = info.dependencies[f];
+ if (dependencies != null) {
+ for (var g in dependencies) {
graph.addEdge(f, g);
}
}
@@ -38,8 +37,9 @@
for (var g in f.uses) {
graph.addEdge(f, g.target);
}
- if (info.dependencies[f] != null) {
- for (var g in info.dependencies[f]) {
+ final dependencies = info.dependencies[f];
+ if (dependencies != null) {
+ for (var g in dependencies) {
graph.addEdge(f, g);
}
}
@@ -54,8 +54,8 @@
// TODO(sigmund): guarantee that the name is actually unique.
String qualifiedName(Info f) {
assert(f is ClosureInfo || f is ClassInfo);
- var element = f;
- String name;
+ Info? element = f;
+ String? name;
while (element != null) {
if (element is LibraryInfo) {
name = '${element.uri}:$name';
@@ -71,10 +71,11 @@
/// Provide a unique long name associated with [info].
// TODO(sigmund): guarantee that the name is actually unique.
String longName(Info info, {bool useLibraryUri = false, bool forId = false}) {
- var infoPath = [];
- while (info != null) {
+ final infoPath = <Info>[];
+ Info? localInfo = info;
+ while (localInfo != null) {
infoPath.add(info);
- info = info.parent;
+ localInfo = localInfo.parent;
}
var sb = StringBuffer();
var first = true;
@@ -113,9 +114,9 @@
}
/// Provides the package name associated with [info] or null otherwise.
-String packageName(Info info) {
+String? packageName(Info info) {
while (info.parent != null) {
- info = info.parent;
+ info = info.parent!;
}
if (info is LibraryInfo) {
if (info.uri.isScheme('package')) {
@@ -129,9 +130,9 @@
///
/// This corresponds to the package name, a Dart core library, 'file' for loose
/// files, or null otherwise.
-String libraryGroupName(Info info) {
+String? libraryGroupName(Info info) {
while (info.parent != null) {
- info = info.parent;
+ info = info.parent!;
}
if (info is LibraryInfo) {
if (info.uri.isScheme('package')) {
diff --git a/pkg/dartdev/lib/src/commands/language_server.dart b/pkg/dartdev/lib/src/commands/language_server.dart
index 65eca06..20d2722 100644
--- a/pkg/dartdev/lib/src/commands/language_server.dart
+++ b/pkg/dartdev/lib/src/commands/language_server.dart
@@ -8,7 +8,9 @@
import 'package:args/args.dart';
import '../core.dart';
+import '../sdk.dart';
import '../utils.dart';
+import '../vm_interop_handler.dart';
class LanguageServerCommand extends DartdevCommand {
static const String commandName = 'language-server';
@@ -38,11 +40,14 @@
@override
Future<int> run() async {
- final driver = server_driver.Driver();
- driver.start(
- argResults!.arguments,
- defaultToLsp: true,
- );
+ if (!Sdk.checkArtifactExists(sdk.analysisServerSnapshot)) return 255;
+
+ VmInteropHandler.run(
+ sdk.analysisServerSnapshot,
+ [
+ ...argResults!.arguments,
+ ],
+ packageConfigOverride: null);
// The server will continue to run past the return from this method.
//
diff --git a/pkg/dds/README.md b/pkg/dds/README.md
index ef1be7d..86d4e7c 100644
--- a/pkg/dds/README.md
+++ b/pkg/dds/README.md
@@ -1,3 +1,6 @@
+[![pub package](https://img.shields.io/pub/v/dds.svg)](https://pub.dev/packages/dds)
+[![package publisher](https://img.shields.io/pub/publisher/dds.svg)](https://pub.dev/packages/dds/publisher)
+
A package used to spawn the Dart Developer Service (DDS), which is used to communicate with a Dart VM Service instance and provide extended functionality to the core VM Service Protocol.
# Functionality
diff --git a/pkg/dds_service_extensions/README.md b/pkg/dds_service_extensions/README.md
index 9f50e4f..2b06db6 100644
--- a/pkg/dds_service_extensions/README.md
+++ b/pkg/dds_service_extensions/README.md
@@ -1,3 +1,6 @@
+[![pub package](https://img.shields.io/pub/v/dds_service_extensions.svg)](https://pub.dev/packages/dds_service_extensions)
+[![package publisher](https://img.shields.io/pub/publisher/dds_service_extensions.svg)](https://pub.dev/packages/dds_service_extensions/publisher)
+
A package used to expand the `package:vm_service` interface with support for RPCs added in the [Dart Developer Service (DDS) protocol][dds-protocol].
[dds-protocol]: https://github.com/dart-lang/sdk/blob/main/pkg/dds/dds_protocol.md
diff --git a/pkg/js/README.md b/pkg/js/README.md
index 4f75675..cf4be84 100644
--- a/pkg/js/README.md
+++ b/pkg/js/README.md
@@ -1,3 +1,6 @@
+[![pub package](https://img.shields.io/pub/v/js.svg)](https://pub.dev/packages/js)
+[![package publisher](https://img.shields.io/pub/publisher/js.svg)](https://pub.dev/packages/js/publisher)
+
Use this package when you want to call JavaScript APIs from Dart code, or vice versa.
This package's main library, `js`, provides annotations and functions
diff --git a/pkg/vm_service/README.md b/pkg/vm_service/README.md
index 6c47181..9308377 100644
--- a/pkg/vm_service/README.md
+++ b/pkg/vm_service/README.md
@@ -1,6 +1,5 @@
-# vm_service
-
[![pub package](https://img.shields.io/pub/v/vm_service.svg)](https://pub.dev/packages/vm_service)
+[![package publisher](https://img.shields.io/pub/publisher/vm_service.svg)](https://pub.dev/packages/vm_service/publisher)
A library to access the VM Service Protocol.
diff --git a/runtime/vm/app_snapshot.cc b/runtime/vm/app_snapshot.cc
index da71473..2b20b44 100644
--- a/runtime/vm/app_snapshot.cc
+++ b/runtime/vm/app_snapshot.cc
@@ -1873,12 +1873,12 @@
// in the current loading unit).
ObjectPoolPtr pool = code->untag()->object_pool_;
if (s->kind() == Snapshot::kFullAOT) {
- TracePool(s, pool, /*only_call_targets=*/is_deferred);
+ TracePool(s, pool, /*only_code=*/is_deferred);
} else {
if (s->InCurrentLoadingUnitOrRoot(pool)) {
s->Push(pool);
} else {
- TracePool(s, pool, /*only_call_targets=*/true);
+ TracePool(s, pool, /*only_code=*/true);
}
}
@@ -1946,7 +1946,7 @@
#endif
}
- void TracePool(Serializer* s, ObjectPoolPtr pool, bool only_call_targets) {
+ void TracePool(Serializer* s, ObjectPoolPtr pool, bool only_code) {
if (pool == ObjectPool::null()) {
return;
}
@@ -1957,18 +1957,8 @@
auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
if (entry_type == ObjectPool::EntryType::kTaggedObject) {
const ObjectPtr target = pool->untag()->data()[i].raw_obj_;
- // A field is a call target because its initializer may be called
- // indirectly by passing the field to the runtime. A const closure
- // is a call target because its function may be called indirectly
- // via a closure call.
- if (!only_call_targets || target->IsCode() || target->IsFunction() ||
- target->IsField() || target->IsClosure()) {
+ if (!only_code || target->IsCode()) {
s->Push(target);
- } else {
- intptr_t cid = target->GetClassIdMayBeSmi();
- if (cid >= kNumPredefinedCids) {
- s->Push(s->isolate_group()->class_table()->At(cid));
- }
}
}
}
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index 6c6a023..ee450a6 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -424,7 +424,6 @@
typeparams_to_retain_(),
consts_to_retain_(),
seen_table_selectors_(),
- api_uses_(),
error_(Error::Handle()),
get_runtime_type_is_unique_(false) {
ASSERT(Precompiler::singleton_ == NULL);
@@ -663,8 +662,6 @@
ProgramVisitor::Dedup(T);
}
- PruneDictionaries();
-
if (retained_reasons_writer_ != nullptr) {
reasons_writer.Write();
retained_reasons_writer_ = nullptr;
@@ -755,7 +752,6 @@
}
}
if (!main.IsNull()) {
- AddApiUse(main);
if (lib.LookupLocalFunction(name) == Function::null()) {
retain_root_library_caches_ = true;
}
@@ -1468,14 +1464,6 @@
return seen_table_selectors_.HasKey(selector_id);
}
-void Precompiler::AddApiUse(const Object& obj) {
- api_uses_.Insert(&Object::ZoneHandle(Z, obj.ptr()));
-}
-
-bool Precompiler::HasApiUse(const Object& obj) {
- return api_uses_.HasKey(&obj);
-}
-
void Precompiler::AddInstantiatedClass(const Class& cls) {
if (is_tracing()) {
tracer_->WriteClassInstantiationRef(cls);
@@ -1535,7 +1523,6 @@
&reusable_object_handle) ==
EntryPointPragma::kAlways) {
AddInstantiatedClass(cls);
- AddApiUse(cls);
}
}
@@ -1554,7 +1541,6 @@
if (pragma == EntryPointPragma::kNever) continue;
AddField(field);
- AddApiUse(field);
if (!field.is_static()) {
if (pragma != EntryPointPragma::kSetterOnly) {
@@ -1583,7 +1569,6 @@
type == EntryPointPragma::kCallOnly) {
functions_with_entry_point_pragmas_.Insert(function);
AddFunction(function, RetainReasons::kEntryPointPragma);
- AddApiUse(function);
}
if ((type == EntryPointPragma::kAlways ||
@@ -1593,16 +1578,10 @@
function2 = function.ImplicitClosureFunction();
functions_with_entry_point_pragmas_.Insert(function2);
AddFunction(function2, RetainReasons::kEntryPointPragma);
-
- // Not `function2`: Dart_GetField will lookup the regular function
- // and get the implicit closure function from that.
- AddApiUse(function);
}
if (function.IsGenerativeConstructor()) {
AddInstantiatedClass(cls);
- AddApiUse(function);
- AddApiUse(cls);
}
}
if (function.kind() == UntaggedFunction::kImplicitGetter &&
@@ -1612,7 +1591,6 @@
if (function.accessor_field() == field.ptr()) {
functions_with_entry_point_pragmas_.Insert(function);
AddFunction(function, RetainReasons::kImplicitGetter);
- AddApiUse(function);
}
}
}
@@ -1623,7 +1601,6 @@
if (function.accessor_field() == field.ptr()) {
functions_with_entry_point_pragmas_.Insert(function);
AddFunction(function, RetainReasons::kImplicitSetter);
- AddApiUse(function);
}
}
}
@@ -1634,15 +1611,9 @@
if (function.accessor_field() == field.ptr()) {
functions_with_entry_point_pragmas_.Insert(function);
AddFunction(function, RetainReasons::kImplicitStaticGetter);
- AddApiUse(function);
}
}
}
- if (function.is_native()) {
- // The embedder will need to lookup this library to provide the native
- // resolver, even if there are no embedder calls into the library.
- AddApiUse(lib);
- }
}
implicit_getters = GrowableObjectArray::null();
@@ -3098,166 +3069,6 @@
}
}
-void Precompiler::PruneDictionaries() {
- // PRODUCT-only: pruning interferes with various uses of the service protocol,
- // including heap analysis tools.
-#if defined(PRODUCT)
- class PruneDictionariesVisitor {
- public:
- GrowableObjectArrayPtr PruneLibraries(
- const GrowableObjectArray& libraries) {
- for (intptr_t i = 0; i < libraries.Length(); i++) {
- lib_ ^= libraries.At(i);
- bool retain = PruneLibrary(lib_);
- if (retain) {
- lib_.set_index(retained_libraries_.Length());
- retained_libraries_.Add(lib_);
- } else {
- lib_.set_index(-1);
- lib_.set_private_key(null_string_);
- }
- }
-
- Library::RegisterLibraries(Thread::Current(), retained_libraries_);
- return retained_libraries_.ptr();
- }
-
- bool PruneLibrary(const Library& lib) {
- dict_ = lib.dictionary();
- intptr_t dict_size = dict_.Length() - 1;
- intptr_t used = 0;
- for (intptr_t i = 0; i < dict_size; i++) {
- entry_ = dict_.At(i);
- if (entry_.IsNull()) continue;
-
- bool retain = false;
- if (entry_.IsClass()) {
- // dart:async: Fix async stack trace lookups in dart:async to annotate
- // entry points or fail gracefully.
- // dart:core, dart:collection, dart:typed_data: Isolate messaging
- // between groups allows any class in these libraries.
- retain = PruneClass(Class::Cast(entry_)) ||
- (lib.url() == Symbols::DartAsync().ptr()) ||
- (lib.url() == Symbols::DartCore().ptr()) ||
- (lib.url() == Symbols::DartCollection().ptr()) ||
- (lib.url() == Symbols::DartTypedData().ptr());
- } else if (entry_.IsFunction() || entry_.IsField()) {
- retain = precompiler_->HasApiUse(entry_);
- } else {
- FATAL("Unexpected library entry: %s", entry_.ToCString());
- }
- if (retain) {
- used++;
- } else {
- dict_.SetAt(i, Object::null_object());
- }
- }
- lib.RehashDictionary(dict_, used * 4 / 3 + 1);
-
- bool retain = used > 0;
- cls_ = lib.toplevel_class();
- if (PruneClass(cls_)) {
- retain = true;
- }
- if (lib.is_dart_scheme()) {
- retain = true;
- }
- if (lib.ptr() == root_lib_.ptr()) {
- retain = true;
- }
- if (precompiler_->HasApiUse(lib)) {
- retain = true;
- }
- return retain;
- }
-
- bool PruneClass(const Class& cls) {
- bool retain = precompiler_->HasApiUse(cls);
-
- functions_ = cls.functions();
- retained_functions_ = GrowableObjectArray::New();
- for (intptr_t i = 0; i < functions_.Length(); i++) {
- function_ ^= functions_.At(i);
- if (precompiler_->HasApiUse(function_)) {
- retained_functions_.Add(function_);
- retain = true;
- } else if (precompiler_->functions_called_dynamically_.ContainsKey(
- function_)) {
- retained_functions_.Add(function_);
- // No `retain = true`: the function must appear in the method
- // dictionary for lookup, but the class may still be removed from the
- // library.
- }
- }
- if (retained_functions_.Length() > 0) {
- functions_ = Array::MakeFixedLength(retained_functions_);
- cls.SetFunctions(functions_);
- } else {
- cls.SetFunctions(Object::empty_array());
- }
-
- fields_ = cls.fields();
- retained_fields_ = GrowableObjectArray::New();
- for (intptr_t i = 0; i < fields_.Length(); i++) {
- field_ ^= fields_.At(i);
- if (precompiler_->HasApiUse(field_)) {
- retained_fields_.Add(field_);
- retain = true;
- }
- }
- if (retained_fields_.Length() > 0) {
- fields_ = Array::MakeFixedLength(retained_fields_);
- cls.SetFields(fields_);
- } else {
- cls.SetFields(Object::empty_array());
- }
-
- return retain;
- }
-
- explicit PruneDictionariesVisitor(Precompiler* precompiler, Zone* zone)
- : precompiler_(precompiler),
- lib_(Library::Handle(zone)),
- dict_(Array::Handle(zone)),
- entry_(Object::Handle(zone)),
- cls_(Class::Handle(zone)),
- functions_(Array::Handle(zone)),
- fields_(Array::Handle(zone)),
- function_(Function::Handle(zone)),
- field_(Field::Handle(zone)),
- retained_functions_(GrowableObjectArray::Handle(zone)),
- retained_fields_(GrowableObjectArray::Handle(zone)),
- retained_libraries_(
- GrowableObjectArray::Handle(zone, GrowableObjectArray::New())),
- root_lib_(Library::Handle(
- zone,
- precompiler->isolate_group()->object_store()->root_library())),
- null_string_(String::Handle(zone)) {}
-
- private:
- Precompiler* const precompiler_;
- Library& lib_;
- Array& dict_;
- Object& entry_;
- Class& cls_;
- Array& functions_;
- Array& fields_;
- Function& function_;
- Field& field_;
- GrowableObjectArray& retained_functions_;
- GrowableObjectArray& retained_fields_;
- const GrowableObjectArray& retained_libraries_;
- const Library& root_lib_;
- const String& null_string_;
- };
-
- HANDLESCOPE(T);
- SafepointWriteRwLocker ml(T, T->isolate_group()->program_lock());
- PruneDictionariesVisitor visitor(this, Z);
- libraries_ = visitor.PruneLibraries(libraries_);
-#endif // defined(PRODUCT)
-}
-
// Traits for the HashTable template.
struct CodeKeyTraits {
static uint32_t Hash(const Object& key) { return Code::Cast(key).Size(); }
diff --git a/runtime/vm/compiler/aot/precompiler.h b/runtime/vm/compiler/aot/precompiler.h
index 50df9e7..4e0d211 100644
--- a/runtime/vm/compiler/aot/precompiler.h
+++ b/runtime/vm/compiler/aot/precompiler.h
@@ -210,37 +210,6 @@
typedef DirectChainedHashMap<TypeArgumentsKeyValueTrait> TypeArgumentsSet;
-class ProgramElementKeyValueTrait {
- public:
- // Typedefs needed for the DirectChainedHashMap template.
- typedef const Object* Key;
- typedef const Object* Value;
- typedef const Object* Pair;
-
- static Key KeyOf(Pair kv) { return kv; }
-
- static Value ValueOf(Pair kv) { return kv; }
-
- static inline uword Hash(Key key) {
- if (key->IsFunction()) {
- return Function::Cast(*key).Hash();
- } else if (key->IsField()) {
- return Field::Cast(*key).kernel_offset();
- } else if (key->IsClass()) {
- return Class::Cast(*key).kernel_offset();
- } else if (key->IsLibrary()) {
- return Library::Cast(*key).index();
- }
- FATAL("Unexpected type: %s\n", key->ToCString());
- }
-
- static inline bool IsKeyEqual(Pair pair, Key key) {
- return pair->ptr() == key->ptr();
- }
-};
-
-typedef DirectChainedHashMap<ProgramElementKeyValueTrait> ProgramElementSet;
-
class InstanceKeyValueTrait {
public:
// Typedefs needed for the DirectChainedHashMap template.
@@ -352,8 +321,6 @@
bool IsHitByTableSelector(const Function& function);
// Returns the reason if the function must be retained, otherwise nullptr.
const char* MustRetainFunction(const Function& function);
- void AddApiUse(const Object& obj);
- bool HasApiUse(const Object& obj);
void ProcessFunction(const Function& function);
void CheckForNewDynamicFunctions();
@@ -376,7 +343,6 @@
void DropClasses();
void DropLibraries();
void DiscardCodeObjects();
- void PruneDictionaries();
DEBUG_ONLY(FunctionPtr FindUnvisitedRetainedFunction());
@@ -427,7 +393,6 @@
TypeParameterSet typeparams_to_retain_;
InstanceSet consts_to_retain_;
TableSelectorSet seen_table_selectors_;
- ProgramElementSet api_uses_;
Error& error_;
compiler::DispatchTableGenerator* dispatch_table_generator_;
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index 7dba48a..d52cc58 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -1891,11 +1891,9 @@
Zone* zone = thread->zone();
intptr_t unit_count = helper_->ReadUInt();
Array& loading_units = Array::Handle(zone, Array::New(unit_count + 1));
- Array& loading_unit_uris = Array::Handle(zone, Array::New(unit_count + 1));
LoadingUnit& unit = LoadingUnit::Handle(zone);
LoadingUnit& parent = LoadingUnit::Handle(zone);
Library& lib = Library::Handle(zone);
- Array& uris = Array::Handle(zone);
for (int i = 0; i < unit_count; i++) {
intptr_t id = helper_->ReadUInt();
@@ -1909,7 +1907,6 @@
unit.set_parent(parent);
intptr_t library_count = helper_->ReadUInt();
- uris = Array::New(library_count);
for (intptr_t j = 0; j < library_count; j++) {
const String& uri =
translation_helper_.DartSymbolPlain(helper_->ReadStringReference());
@@ -1918,18 +1915,14 @@
FATAL1("Missing library: %s\n", uri.ToCString());
}
lib.set_loading_unit(unit);
- uris.SetAt(j, uri);
}
loading_units.SetAt(id, unit);
- loading_unit_uris.SetAt(id, uris);
}
ObjectStore* object_store = IG->object_store();
ASSERT(object_store->loading_units() == Array::null());
object_store->set_loading_units(loading_units);
- ASSERT(object_store->loading_unit_uris() == Array::null());
- object_store->set_loading_unit_uris(loading_unit_uris);
}
CallSiteAttributesMetadataHelper::CallSiteAttributesMetadataHelper(
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index f8b05d2..4f03fb7a 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -6728,12 +6728,24 @@
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION(T);
- const Array& loading_units =
- Array::Handle(Z, T->isolate_group()->object_store()->loading_unit_uris());
- if (loading_unit_id >= 0 && loading_unit_id < loading_units.Length()) {
- return Api::NewHandle(T, loading_units.At(loading_unit_id));
+ const GrowableObjectArray& result =
+ GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
+ const GrowableObjectArray& libs = GrowableObjectArray::Handle(
+ Z, T->isolate_group()->object_store()->libraries());
+ Library& lib = Library::Handle(Z);
+ LoadingUnit& unit = LoadingUnit::Handle(Z);
+ String& uri = String::Handle(Z);
+ for (intptr_t i = 0; i < libs.Length(); i++) {
+ lib ^= libs.At(i);
+ unit = lib.loading_unit();
+ if (unit.IsNull() || (unit.id() != loading_unit_id)) {
+ continue;
+ }
+ uri = lib.url();
+ result.Add(uri);
}
- return Api::NewError("Invalid loading_unit_id");
+
+ return Api::NewHandle(T, Array::MakeFixedLength(result));
#endif
}
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 9e867c4..46d3e1b 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12448,12 +12448,8 @@
untag()->set_name(name.ptr());
}
-void Library::set_url(const String& url) const {
- untag()->set_url(url.ptr());
-}
-
-void Library::set_private_key(const String& key) const {
- untag()->set_private_key(key.ptr());
+void Library::set_url(const String& name) const {
+ untag()->set_url(name.ptr());
}
void Library::set_kernel_data(const ExternalTypedData& data) const {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index dd1699a..6f226c3 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -5109,7 +5109,6 @@
// the name and url.
void set_name(const String& name) const;
void set_url(const String& url) const;
- void set_private_key(const String& key) const;
void set_num_imports(intptr_t value) const;
void set_flags(uint8_t flags) const;
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index 718e61d..674d1b4 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -261,7 +261,6 @@
RW(Array, dispatch_table_code_entries) \
RW(GrowableObjectArray, instructions_tables) \
RW(Array, obfuscation_map) \
- RW(Array, loading_unit_uris) \
RW(GrowableObjectArray, ffi_callback_functions) \
RW(Class, ffi_pointer_class) \
RW(Class, ffi_native_type_class) \
diff --git a/sdk/lib/_internal/vm/bin/socket_patch.dart b/sdk/lib/_internal/vm/bin/socket_patch.dart
index a70896e..d0bddf8 100644
--- a/sdk/lib/_internal/vm/bin/socket_patch.dart
+++ b/sdk/lib/_internal/vm/bin/socket_patch.dart
@@ -2543,7 +2543,6 @@
}
@patch
-@pragma("vm:entry-point")
class ResourceHandle {
factory ResourceHandle.fromFile(RandomAccessFile file) {
int fd = (file as _RandomAccessFile).fd;
diff --git a/tools/VERSION b/tools/VERSION
index 92973e7..72045af 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 157
+PRERELEASE 158
PRERELEASE_PATCH 0
\ No newline at end of file