Skip to content

Commit

Permalink
Version 3.5.0-88.0.dev
Browse files Browse the repository at this point in the history
Merge 22da6ed into dev
  • Loading branch information
Dart CI committed Apr 23, 2024
2 parents 4aa8f4c + 22da6ed commit 9f64eec
Show file tree
Hide file tree
Showing 14 changed files with 311 additions and 308 deletions.
8 changes: 4 additions & 4 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ vars = {
"args_rev": "5c83bc9785d6c32ffe6824ba79fadcc51fbcd1c1",
"async_rev": "47968047eb9888f74ca0691640821bd55b47e763",
"bazel_worker_rev": "79d2ad13c83d5e0883136503d86ddf60fe665900",
"benchmark_harness_rev": "d23112a0e6ea8101854bff608250c7ee1ea52a01",
"benchmark_harness_rev": "aa139fdf3a3b829fa8c10719102c66729495afb6",
"boolean_selector_rev": "24635df68661bb44c1c13fb405562421e24298e5",
"browser_launcher_rev": "c4b2c81aa9debcce3651eda1b68a9bc5d5adf400",
"characters_rev": "7633a16a22c626e19ca750223237396315268a06",
Expand All @@ -144,7 +144,7 @@ vars = {
#
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
"dart_style_rev": "a6ad7693555a9add6f98ad6fd94de80d35c89415", # disable tools/rev_sdk_deps.dart
"dartdoc_rev": "592694e0557122c59f9eaf007dd8139d84d411d8",
"dartdoc_rev": "1ae5b4c0e8c63fb53df0540e42a709efb88d1af4",
"ecosystem_rev": "9fabe464ea1d8408774de74d2ac759c1f90ae480",
"file_rev": "f858c6fe9d1b0167b944aa62dd9b4321036b5238",
"fixnum_rev": "dec16eb715f70f2fe0ed509da2e118354bea21d8",
Expand Down Expand Up @@ -186,14 +186,14 @@ vars = {
"test_descriptor_rev": "b61cfb4479fafd78eb9d365cc2f7cdb43c2aed34",
"test_process_rev": "94ee46d76f89ebb7d73cef3e23bab288b1e43b50",
"test_reflective_loader_rev": "d7167a2375d8a0c02c12b960c059a115a777f238",
"tools_rev": "d86ea23c79d2e9dc622d3376aa80d94fbf30bf60",
"tools_rev": "3e21ae9cea75987365249f2c067eabd16fbaf2d7",
"typed_data_rev": "8c7393cbbbba7a5d38c6772371f92d6b38e433fc",
"usage_rev": "2847cdb94e238a921c600e81b52c91baf4ea0b50",
"vector_math_rev": "43f2a77bb0be812b027a68a11792d563713b42a1",
"watcher_rev": "1bd2f20d0d924c8422aa2b9afdb165bff4f053c0",
"web_rev": "9d8c802d13b785b1a5b201c4a43605d640841c98",
"web_socket_channel_rev": "b612fc2caa9f4c3c8947b4ffbb274bce33c54a04",
"webdev_rev": "3a10b76f3937fb9b50e7971fb15f82b65dfe05ef",
"webdev_rev": "d4f9f6720e727c93781ec4425bc5f7a16ece33b0",
"webdriver_rev": "c80e01e6ce121e55c31e33a31e5d3950023e6bc9",
"webkit_inspection_protocol_rev": "153fea4fe5ac45bebf0c2e76bb3d76b0f1fcdaae",
"yaml_rev": "5a1c4be2437bc4122ccf08a3a0f06a7683e62f30",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3691,7 +3691,7 @@ WarningCode.INVALID_REQUIRED_POSITIONAL_PARAM:
status: hasFix
WarningCode.INVALID_SEALED_ANNOTATION:
status: hasFix
WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER:
WarningCode.invalid_use_of_do_not_submit_member:
status: needsEvaluation
WarningCode.INVALID_USE_OF_INTERNAL_MEMBER:
status: noFix
Expand Down
63 changes: 30 additions & 33 deletions pkg/analysis_server/lib/src/services/correction/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -425,39 +425,39 @@ final class CorrectionUtils {

String get twoIndents => _twoIndents;

/// Returns the [AstNode] that encloses the given offset.
/// Returns the [AstNode] that encloses the given [offset].
AstNode? findNode(int offset) => NodeLocator(offset).searchWithin(_unit);

/// Skips whitespace characters and single EOL on the right from [index].
///
/// If [index] the end of a statement or method, then in the most cases it is
/// a start of the next line.
/// If [index] the end of a statement or method, then in most cases this
/// returns the start of the next line.
int getLineContentEnd(int index) {
var length = _buffer.length;
// skip whitespace characters
// Skip whitespace characters.
while (index < length) {
var c = _buffer.codeUnitAt(index);
if (!c.isWhitespace || c.isEOL) {
break;
}
index++;
}
// skip single \r
// Skip a single '\r' character.
if (index < length && _buffer.codeUnitAt(index) == 0x0D) {
index++;
}
// skip single \n
// Skip a single '\n' character.
if (index < length && _buffer.codeUnitAt(index) == 0x0A) {
index++;
}
// done
// Done.
return index;
}

/// Skips spaces and tabs on the left from [index].
///
/// If [index] is the start or a statement, then in the most cases it is a
/// start on its line.
/// If [index] is the start or a statement, then in most cases this returns
/// the offset of the line in which [index] is found.
int getLineContentStart(int index) {
while (index > 0) {
var c = _buffer.codeUnitAt(index - 1);
Expand All @@ -469,8 +469,8 @@ final class CorrectionUtils {
return index;
}

/// Returns a start index of the next line after the line which contains the
/// given index.
/// Returns the index of the start of the line following the line which
/// contains the given [index].
int getLineNext(int index) {
var length = _buffer.length;
// skip to the end of the line
Expand All @@ -481,19 +481,19 @@ final class CorrectionUtils {
}
index++;
}
// skip single \r
// Skip a single '\r'.
if (index < length && _buffer.codeUnitAt(index) == 0xD) {
index++;
}
// skip single \n
// Skip a single '\n'.
if (index < length && _buffer.codeUnitAt(index) == 0xA) {
index++;
}
// done
// Done.
return index;
}

/// Returns the whitespace prefix of the line which contains given offset.
/// Returns the whitespace prefix of the line which contains given [index].
String getLinePrefix(int index) {
var lineStart = getLineThis(index);
var length = _buffer.length;
Expand Down Expand Up @@ -541,7 +541,7 @@ final class CorrectionUtils {
return getLinesRange(range.nodes(statements));
}

/// Returns the start index of the line which contains given index.
/// Returns the start index of the line which contains the given [index].
int getLineThis(int index) {
while (index > 0) {
var c = _buffer.codeUnitAt(index - 1);
Expand All @@ -553,8 +553,7 @@ final class CorrectionUtils {
return index;
}

/// Returns the line prefix consisting of spaces and tabs on the left from the
/// given [AstNode].
/// Returns the whitespace prefix of the line which contains given [node].
String getNodePrefix(AstNode node) {
var offset = node.offset;
// function literal is special, it uses offset of enclosing line
Expand All @@ -565,7 +564,8 @@ final class CorrectionUtils {
return getPrefix(offset);
}

/// Returns the text of the given [AstNode] in the unit.
/// Returns the text of the given [AstNode] in the unit, including preceding
/// comments.
String getNodeText(
AstNode node, {
bool withLeadingComments = false,
Expand All @@ -579,8 +579,7 @@ final class CorrectionUtils {
return getText(offset, length);
}

/// Returns the line prefix consisting of spaces and tabs on the left from the
/// given offset.
/// Returns the whitespace prefix to the left of the given [endIndex].
String getPrefix(int endIndex) {
var startIndex = getLineContentStart(endIndex);
return _buffer.substring(startIndex, endIndex);
Expand All @@ -593,7 +592,7 @@ final class CorrectionUtils {
String getText(int offset, int length) =>
_buffer.substring(offset, offset + length);

/// Indents given source left or right.
/// Indents the given [source] left or right.
String indentSourceLeftRight(String source, {bool indentLeft = true}) {
var sb = StringBuffer();
var indent = oneIndent;
Expand Down Expand Up @@ -632,10 +631,9 @@ final class CorrectionUtils {
/// If [ensureTrailingNewline] is `true`, a newline will be added to
/// the end of the returned code if it does not already have one.
///
/// Usually [includeLeading] and [ensureTrailingNewline] will both be set
/// together when indenting a set of statements to go inside a block (as
/// opposed to just wrapping a nested expression that might span multiple
/// lines).
/// Usually [includeLeading] and [ensureTrailingNewline] are set together,
/// when indenting a set of statements to go inside a block (as opposed to
/// just wrapping a nested expression that might span multiple lines).
String replaceSourceIndent(String source, String oldIndent, String newIndent,
{bool includeLeading = false, bool ensureTrailingNewline = false}) {
// Prepare token ranges.
Expand Down Expand Up @@ -700,10 +698,9 @@ final class CorrectionUtils {
/// If [ensureTrailingNewline] is `true`, a newline will be added to
/// the end of the returned code if it does not already have one.
///
/// Usually [includeLeading] and [ensureTrailingNewline] will both be set
/// together when indenting a set of statements to go inside a block (as
/// opposed to just wrapping a nested expression that might span multiple
/// lines).
/// Usually [includeLeading] and [ensureTrailingNewline] are set together,
/// when indenting a set of statements to go inside a block (as opposed to
/// just wrapping a nested expression that might span multiple lines).
String replaceSourceRangeIndent(
SourceRange range, String oldIndent, String newIndent,
{bool includeLeading = false, bool ensureTrailingNewline = false}) {
Expand Down Expand Up @@ -781,10 +778,10 @@ final class CorrectionUtils {
return _InvertedCondition._simple(getNodeText(expression));
}

/// Skip spaces, tabs and EOLs on the left from [index].
/// Skips whitespace and EOLs to the left of [index].
///
/// If [index] is the start of a method, then in the most cases return the end
/// of the previous not-whitespace line.
/// If [index] is the start of a method declaration, then in most cases, this
/// returns the end of the previous non-whitespace line.
int _skipEmptyLinesLeft(int index) {
var lastLine = index;
while (index > 0) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/analysis/context_locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ContextLocatorImpl implements ContextLocator {
/// analysis options file.
///
/// See: https://github.com/dart-lang/sdk/issues/53876
static bool singleOptionContexts = true;
static bool singleOptionContexts = false;

/// The resource provider used to access the file system.
final ResourceProvider resourceProvider;
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/error/best_practices_verifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ class _InvalidAccessVerifier {
_errorReporter.atOffset(
offset: errorEntity.offset,
length: errorEntity.length,
errorCode: WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER,
errorCode: WarningCode.invalid_use_of_do_not_submit_member,
arguments: [name],
);
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/analyzer/lib/src/error/codes.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6766,15 +6766,6 @@ class WarningCode extends AnalyzerErrorCode {
hasPublishedDocs: true,
);

/// Parameters:
/// 0: the name of the member
static const WarningCode INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER = WarningCode(
'INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER',
"Uses of '{0}' should not be submitted to source control.",
correctionMessage: "Try removing the reference to '{0}'.",
hasPublishedDocs: true,
);

/// Parameters:
/// 0: the name of the member
static const WarningCode INVALID_USE_OF_INTERNAL_MEMBER = WarningCode(
Expand Down Expand Up @@ -7554,6 +7545,15 @@ class WarningCode extends AnalyzerErrorCode {
hasPublishedDocs: true,
);

/// Parameters:
/// 0: the name of the member
static const WarningCode invalid_use_of_do_not_submit_member = WarningCode(
'invalid_use_of_do_not_submit_member',
"Uses of '{0}' should not be submitted to source control.",
correctionMessage: "Try removing the reference to '{0}'.",
hasPublishedDocs: true,
);

/// Initialize a newly created error code to have the given [name].
const WarningCode(
String name,
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/error/error_code_values.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,6 @@ const List<ErrorCode> errorCodeValues = [
WarningCode.INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM,
WarningCode.INVALID_REQUIRED_POSITIONAL_PARAM,
WarningCode.INVALID_SEALED_ANNOTATION,
WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER,
WarningCode.INVALID_USE_OF_INTERNAL_MEMBER,
WarningCode.INVALID_USE_OF_PROTECTED_MEMBER,
WarningCode.INVALID_USE_OF_VISIBLE_FOR_OVERRIDING_MEMBER,
Expand Down Expand Up @@ -1104,4 +1103,5 @@ const List<ErrorCode> errorCodeValues = [
WarningCode.UNUSED_RESULT,
WarningCode.UNUSED_RESULT_WITH_MESSAGE,
WarningCode.UNUSED_SHOWN_NAME,
WarningCode.invalid_use_of_do_not_submit_member,
];
2 changes: 1 addition & 1 deletion pkg/analyzer/messages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24097,7 +24097,7 @@ WarningCode:

Parameters:
0: the name of the member
INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER:
invalid_use_of_do_not_submit_member:
problemMessage: "Uses of '{0}' should not be submitted to source control."
correctionMessage: "Try removing the reference to '{0}'."
comment: |-
Expand Down
24 changes: 12 additions & 12 deletions pkg/analyzer/test/src/diagnostics/invalid_do_not_submit_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 31, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 31, 1),
]);
}

Expand All @@ -69,7 +69,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 31, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 31, 1),
]);
}

Expand All @@ -90,7 +90,7 @@ import 'a.dart';
void b() {
// OK.
a();
// Also OK in a closure.
() {
a();
Expand Down Expand Up @@ -139,7 +139,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 39, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 39, 1),
]);
}

Expand All @@ -163,7 +163,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 33, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 33, 1),
]);
}

Expand All @@ -187,7 +187,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 33, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 33, 1),
]);
}

Expand All @@ -207,7 +207,7 @@ void b() => a();

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 30, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 30, 1),
]);
}

Expand All @@ -232,7 +232,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 54, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 54, 1),
]);
}

Expand Down Expand Up @@ -279,7 +279,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 48, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 48, 1),
]);
}

Expand All @@ -300,7 +300,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 33, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 33, 1),
]);
}

Expand Down Expand Up @@ -338,7 +338,7 @@ void b() {

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 48, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 48, 1),
]);
}

Expand All @@ -358,7 +358,7 @@ void b() => print(a);

await assertErrorsInFile2(a, []);
await assertErrorsInFile2(b, [
error(WarningCode.INVALID_USE_OF_DO_NOT_SUBMIT_MEMBER, 36, 1),
error(WarningCode.invalid_use_of_do_not_submit_member, 36, 1),
]);
}
}
Loading

0 comments on commit 9f64eec

Please sign in to comment.