Version 2.12.0-219.0.dev
Merge commit '93706517736022cf0d63e9b4a731cb879a22f4d8' into 'dev'
diff --git a/pkg/nnbd_migration/lib/migration_cli.dart b/pkg/nnbd_migration/lib/migration_cli.dart
index d8468bd..0c70a3e 100644
--- a/pkg/nnbd_migration/lib/migration_cli.dart
+++ b/pkg/nnbd_migration/lib/migration_cli.dart
@@ -796,7 +796,26 @@
/// return additional paths that aren't inside the user's project, but doesn't
/// override this method, then those additional paths will be analyzed but not
/// migrated.
- bool shouldBeMigrated(DriverBasedAnalysisContext context, String path) {
+ ///
+ /// Note: in a future version of the code, the [context] argument will be
+ /// removed; to ease the transition, clients should stop overriding this
+ /// method and should override [shouldBeMigrated2] instead.
+ bool shouldBeMigrated(DriverBasedAnalysisContext context, String path) =>
+ shouldBeMigrated2(path);
+
+ /// Determines whether a migrated version of the file at [path] should be
+ /// output by the migration too. May be overridden by a derived class.
+ ///
+ /// This method should return `false` for files that are being considered by
+ /// the migration tool for information only (for example generated files, or
+ /// usages of the code-to-be-migrated by one one of its clients).
+ ///
+ /// By default returns `true` if the file is contained within the context
+ /// root. This means that if a client overrides [computePathsToProcess] to
+ /// return additional paths that aren't inside the user's project, but doesn't
+ /// override this method, then those additional paths will be analyzed but not
+ /// migrated.
+ bool shouldBeMigrated2(String path) {
return analysisContext.contextRoot.isAnalyzed(path);
}
diff --git a/pkg/nnbd_migration/test/migration_cli_test.dart b/pkg/nnbd_migration/test/migration_cli_test.dart
index 1f85e00..c21ca01 100644
--- a/pkg/nnbd_migration/test/migration_cli_test.dart
+++ b/pkg/nnbd_migration/test/migration_cli_test.dart
@@ -184,9 +184,9 @@
}
@override
- bool shouldBeMigrated(DriverBasedAnalysisContext context, String path) =>
+ bool shouldBeMigrated2(String path) =>
cli._test.overrideShouldBeMigrated?.call(path) ??
- super.shouldBeMigrated(context, path);
+ super.shouldBeMigrated2(path);
/// Sorts the paths in [paths] for repeatability of migration tests.
Set<String> _sortPaths(Set<String> paths) {
diff --git a/sdk/lib/convert/base64.dart b/sdk/lib/convert/base64.dart
index 0955ca1..5fcab0a 100644
--- a/sdk/lib/convert/base64.dart
+++ b/sdk/lib/convert/base64.dart
@@ -11,11 +11,11 @@
/// does not allow invalid characters and requires padding.
///
/// Examples:
-///
-/// var encoded = base64.encode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
-/// 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
-/// var decoded = base64.decode("YmzDpWLDpnJncsO4ZAo=");
-///
+/// ```dart
+/// var encoded = base64.encode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
+/// 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
+/// var decoded = base64.decode("YmzDpWLDpnJncsO4ZAo=");
+/// ```
/// The top-level [base64Encode] and [base64Decode] functions may be used
/// instead if a local variable shadows the [base64] constant.
const Base64Codec base64 = Base64Codec();
@@ -27,10 +27,11 @@
/// does not allow invalid characters and requires padding.
///
/// Examples:
-///
-/// var encoded = base64Url.encode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
-/// 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
-/// var decoded = base64Url.decode("YmzDpWLDpnJncsO4ZAo=");
+/// ```dart
+/// var encoded = base64Url.encode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
+/// 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
+/// var decoded = base64Url.decode("YmzDpWLDpnJncsO4ZAo=");
+/// ```
const Base64Codec base64Url = Base64Codec.urlSafe();
/// Encodes [bytes] using [base64](https://tools.ietf.org/html/rfc4648) encoding.
diff --git a/sdk/lib/convert/convert.dart b/sdk/lib/convert/convert.dart
index 1ea3d26..081f006 100644
--- a/sdk/lib/convert/convert.dart
+++ b/sdk/lib/convert/convert.dart
@@ -11,9 +11,9 @@
/// chain and to use with streams.
///
/// To use this library in your code:
-///
-/// import 'dart:convert';
-///
+/// ```dart
+/// import 'dart:convert';
+/// ```
/// Two commonly used converters are the top-level instances of
/// [JsonCodec] and [Utf8Codec], named [json] and [utf8], respectively.
///
@@ -34,19 +34,19 @@
/// as it's read from a file,
/// The second is an instance of [LineSplitter],
/// which splits the data on newline boundaries.
+/// ```dart
+/// var lineNumber = 1;
+/// var stream = File('quotes.txt').openRead();
///
-/// var lineNumber = 1;
-/// var stream = File('quotes.txt').openRead();
-///
-/// stream.transform(utf8.decoder)
-/// .transform(const LineSplitter())
-/// .listen((line) {
-/// if (showLineNumbers) {
-/// stdout.write('${lineNumber++} ');
-/// }
-/// stdout.writeln(line);
-/// });
-///
+/// stream.transform(utf8.decoder)
+/// .transform(const LineSplitter())
+/// .listen((line) {
+/// if (showLineNumbers) {
+/// stdout.write('${lineNumber++} ');
+/// }
+/// stdout.writeln(line);
+/// });
+/// ```
/// See the documentation for the [Codec] and [Converter] classes
/// for information about creating your own converters.
///
diff --git a/sdk/lib/convert/json.dart b/sdk/lib/convert/json.dart
index e55bc2a..33eaab6 100644
--- a/sdk/lib/convert/json.dart
+++ b/sdk/lib/convert/json.dart
@@ -56,10 +56,10 @@
/// use cases.
///
/// Examples:
-///
-/// var encoded = json.encode([1, 2, { "a": null }]);
-/// var decoded = json.decode('["foo", { "bar": 499 }]');
-///
+/// ```dart
+/// var encoded = json.encode([1, 2, { "a": null }]);
+/// var decoded = json.decode('["foo", { "bar": 499 }]');
+/// ```
/// The top-level [jsonEncode] and [jsonDecode] functions may be used instead if
/// a local variable shadows the [json] constant.
const JsonCodec json = JsonCodec();
@@ -99,9 +99,10 @@
/// JSON objects.
///
/// Examples:
-///
-/// var encoded = json.encode([1, 2, { "a": null }]);
-/// var decoded = json.decode('["foo", { "bar": 499 }]');
+/// ```dart
+/// var encoded = json.encode([1, 2, { "a": null }]);
+/// var decoded = json.decode('["foo", { "bar": 499 }]');
+/// ```
class JsonCodec extends Codec<Object?, String> {
final Object? Function(Object? key, Object? value)? _reviver;
final Object? Function(dynamic)? _toEncodable;
@@ -246,7 +247,7 @@
/// If the conversion throws, or returns a value that is not directly
/// serializable, a [JsonUnsupportedObjectError] exception is thrown.
/// If the call throws, the error is caught and stored in the
- /// [JsonUnsupportedObjectError]'s [:cause:] field.
+ /// [JsonUnsupportedObjectError]'s `cause` field.
///
/// If a [List] or [Map] contains a reference to itself, directly or through
/// other lists or maps, it cannot be serialized and a [JsonCyclicError] is
diff --git a/sdk/lib/convert/utf.dart b/sdk/lib/convert/utf.dart
index c74f918..bbfba77 100644
--- a/sdk/lib/convert/utf.dart
+++ b/sdk/lib/convert/utf.dart
@@ -16,10 +16,11 @@
/// use cases.
///
/// Examples:
-///
-/// var encoded = utf8.encode("Îñţérñåţîöñåļîžåţîờñ");
-/// var decoded = utf8.decode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
-/// 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
+/// ```dart
+/// var encoded = utf8.encode("Îñţérñåţîöñåļîžåţîờñ");
+/// var decoded = utf8.decode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
+/// 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
+/// ```
const Utf8Codec utf8 = Utf8Codec();
/// A [Utf8Codec] encodes strings to utf-8 code units (bytes) and decodes
diff --git a/tools/VERSION b/tools/VERSION
index 52f5ed8b..d95fb06 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 12
PATCH 0
-PRERELEASE 218
+PRERELEASE 219
PRERELEASE_PATCH 0
\ No newline at end of file