Skip to content

Commit

Permalink
Version 3.5.0-12.0.dev
Browse files Browse the repository at this point in the history
Merge add2f41 into dev
  • Loading branch information
Dart CI committed Apr 2, 2024
2 parents 091dd91 + add2f41 commit 88a81dd
Show file tree
Hide file tree
Showing 91 changed files with 1,955 additions and 1,274 deletions.
72 changes: 36 additions & 36 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,18 @@ vars = {
# revision.

"args_rev": "788d93541a578e49f066699e1584bc3ce591c376",
"async_rev": "1556660ca5159d84bf28239825a25dca58f1fde3",
"async_rev": "47968047eb9888f74ca0691640821bd55b47e763",
"bazel_worker_rev": "8619b92baa9959e55b9fc49d2afcd6dda2ec1c10",
"benchmark_harness_rev": "c8a0c8b1883dc16c7558a43cee1c3f4f9a163418",
"boolean_selector_rev": "be88351e521648d381b96350bfe62c34abacee6d",
"browser_launcher_rev": "79562306c86e5c087359a31a60309c8d65a699d3",
"boolean_selector_rev": "24635df68661bb44c1c13fb405562421e24298e5",
"browser_launcher_rev": "c4b2c81aa9debcce3651eda1b68a9bc5d5adf400",
"characters_rev": "7633a16a22c626e19ca750223237396315268a06",
"cli_util_rev": "ffeb5d2869b44b28d1b9035b540d164af44f3f1c",
"clock_rev": "daf0fadabc5b3dc8e6e71bf3fb27ef9c3b79df5c",
"cli_util_rev": "12cd216263be587a648600b40017463341bccaf8",
"clock_rev": "a732a09149708ae0b986bec9931576d22818d158",
"collection_rev": "fc616ff8fd7b732c07b2b19e31b6601e59900ccf",
"convert_rev": "d4d6368cffb8f4f25522875ef8e1d5f7d158bbad",
"crypto_rev": "69d13c9903d4134582ce1bbd9a31cfd8a510c22d",
"csslib_rev": "42165256befc3994db510695c17e718e617435c9",
"convert_rev": "186ac2281f0436451b49e1bd8458ff791b42637d",
"crypto_rev": "1c7fbadd92a44322ee1e89eec9747a24dc6c6746",
"csslib_rev": "171ed4885f1db13e22b04b513a169e7a99d2c5d5",
# Note: Updates to dart_style have to be coordinated with the infrastructure
# team so that the internal formatter `tools/sdks/dart-sdk/bin/dart format`
# matches the version here. Please follow this process to make updates:
Expand All @@ -147,57 +147,57 @@ vars = {
"dartdoc_rev": "bf6080c8a12bf3a2f29f517d152bbd5fa1bb0a37",
"ecosystem_rev": "5a900ca68466efe8680d3500bc0a6172d07ef5a7",
"file_rev": "3aa06490bf34bddf04c7ea964a50c177a4ca0de7",
"fixnum_rev": "570b28adcfbfdd5b8a7230ea1d6ec0f9587493f1",
"fixnum_rev": "dec16eb715f70f2fe0ed509da2e118354bea21d8",
"flute_rev": "a531c96a8b43d015c6bfbbfe3ab54867b0763b8b",
"glob_rev": "379d60c7cc5c0e9fe7d0d45549ad0b1ca51396c8",
"html_rev": "327e37a6a4dd46599737ee982f280d73a8f646f7",
"http_rev": "280d3615a2d248d155e87766c9d9bcf586af2c3c",
"html_rev": "5b99b43f71da0c6b0f962244c7f5dfa8ca970fef",
"http_rev": "5214f7647ea7a7dd360f12625358bd39f8e6aec0",
"http_multi_server_rev": "ba9d07f3596b24718ddf45c9e071d40879cca565",
"http_parser_rev": "84db8b029d9b51859a0bb4966859af009f9442e3",
"intl_rev": "5d65e3808ce40e6282e40881492607df4e35669f",
"json_rpc_2_rev": "639857be892050159f5164c749d7947694976a4a",
"leak_tracker_rev": "f5620600a5ce1c44f65ddaa02001e200b096e14c", # manually rolled
"lints_rev": "ead770872e272e25a64315c120950ea8ad5b2509",
"logging_rev": "7a7bd5e31ddfe23e34d37ded82d6d0cd5706862c",
"markdown_rev": "8d07abc6bce001b000097eca35c2f5e37538702a",
"matcher_rev": "d954c8d979579b4b46427b0ea1d9c721117c191e",
"lints_rev": "df9bcbf6dd8964468d0bfa0b1b7286cf850c1656",
"logging_rev": "dcaf2498e5ce34b17b48770b4e78c44fc9e63cd3",
"markdown_rev": "782b1803a29aa964410d93b4437d5d1efa47f6b4",
"matcher_rev": "54c2798d9b75c6db5cdcc7acbf5b9ae215316ed5",
"material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
"mime_rev": "9a168712d6db610c3822617c132daea72d4fd2b5",
"mime_rev": "0a32241c4fcd077a945949760b287677e4d7aff4",
"mockito_rev": "3ef744f8749864f2a036eba60c4203cc8f638949",
"native_rev": "71ada4b5c8001e6b8207ed40331d158e0912cd94", # mosum@ and dacoharkes@ are rolling breaking changes manually while the assets features are in experimental.
"package_config_rev": "3d90e6955ef19b7ce4f1b742a06a20ed4260700a",
"path_rev": "a7b696071bd83d3ee0a0f1b57ac94d6b1f05cac4",
"pool_rev": "c118f69d8a6441a8453bf7d455fd7c79d3ee1497",
"path_rev": "a7284b9917830c18618b26d396d0f0bffc92bb01",
"pool_rev": "8055cbb290590e761e1149dfbf7c2283fdd88e4f",
"protobuf_rev": "b7613581d847e1e36e76f0e36db3a412d8fea5b1",
"pub_rev": "3f0df78417f7c112b933fbcdc1c5c87bde680cb1", # disable tools/rev_sdk_deps.dart
"pub_semver_rev": "3175ba0a58a96fb23f8d68b5f5c44d1a5b30cc16",
"shelf_rev": "1acbc673326e5b31280184744f2864a8f92c5b46",
"source_map_stack_trace_rev": "c75649651d01826236e3ab7093d277a70756905a",
"shelf_rev": "68cb8641c3181cc76006887a7e93b9d3a423f590",
"source_map_stack_trace_rev": "d03fd9b1cc11f2ad61ccc2e71bfd8d2558019a6d",
"source_maps_rev": "55e92a4b0a8560d5b2b3bb7255249afdb8186ea6",
"source_span_rev": "21a403a75b6887fbd811fb53b74b08c2cef67ab6",
"sse_rev": "b53ba14de4fe9823432ebfbb4ec04f23a620ec50",
"stack_trace_rev": "155f12c51226d6372f6722f5e55c38ef39625006",
"stream_channel_rev": "e02a5ddef804f0d546a405ab3917fb27788acaef",
"string_scanner_rev": "a2bcdb575f6bb30b944b4f632ea95d8dc4f914bd",
"sse_rev": "1ab266ad570134294468225d1c2ffe86338005be",
"stack_trace_rev": "c39ae6e955a76a2ff183288f051f4eee7a5e94d1",
"stream_channel_rev": "5f72035464ea675c75982b80db967943a0cfddcb",
"string_scanner_rev": "8dbfddf9a7e8cdd4978ddd3cdab188cfabc543fd",
"sync_http_rev": "b849559fedc7c5d19a68950f255b6edde6eec6ef",
"tar_rev": "6150a0c88d9bd17e3e961593a9a7a9564866e8b4",
"term_glyph_rev": "85a4aa6bf25cd6ecaa5c56a1b259b2d95264a439",
"test_rev": "6a4e75a6283b1366ea21067f9ced0b6c87745d4a",
"test_descriptor_rev": "35f97afacb2b7fe627f6ed0bede722fd48980848",
"test_process_rev": "7fe39afbb6c444f256c1ec0eef008edebcd44644",
"test_reflective_loader_rev": "9862703a3d14848376c8efde271c88022fba91eb",
"term_glyph_rev": "2ad48ce95b6e6d001251d55b15719ee113caf802",
"test_rev": "ce3c8cac1d8e7f055d5443993ac6c0204da17a45",
"test_descriptor_rev": "b61cfb4479fafd78eb9d365cc2f7cdb43c2aed34",
"test_process_rev": "94ee46d76f89ebb7d73cef3e23bab288b1e43b50",
"test_reflective_loader_rev": "d7167a2375d8a0c02c12b960c059a115a777f238",
"tools_rev": "f611290b530123ee2f0a3fda7c440d85dd080a30", # https://github.com/dart-lang/tools/pull/247
"typed_data_rev": "375efaa02a13dad0785cfbd9bdcb9f09aa8ef529",
"typed_data_rev": "8c7393cbbbba7a5d38c6772371f92d6b38e433fc",
"usage_rev": "67ecd7d1328347ec15cbf8d8a46918df75a66af8",
"vector_math_rev": "7e705f734e94917e9a5347578e6e496f8db38ac6",
"watcher_rev": "21858a41da1482922e03ee65cdf2169d01d59a67",
"web_rev": "c522718242d535d8040447b0cc1d47df7f2525a4",
"web_socket_channel_rev": "3db86bc0a09e1038a0fa418262c8a92211c5de69",
"watcher_rev": "1bd2f20d0d924c8422aa2b9afdb165bff4f053c0",
"web_rev": "e773de957b289d001c90c6b830e91634e305667d",
"web_socket_channel_rev": "19d82db86acb7309dd08c40a2af3285232751e83",
"webdev_rev": "51b5484348b4a8ede351e8dff0428b083495ba78", # https://github.com/flutter/devtools/issues/7231
"webdriver_rev": "73a7ac8c0dcb0f84eae47e2133805295176aa972",
"webdriver_rev": "c80e01e6ce121e55c31e33a31e5d3950023e6bc9",
"webkit_inspection_protocol_rev": "153fea4fe5ac45bebf0c2e76bb3d76b0f1fcdaae",
"yaml_rev": "e5984433a2803d5c67ed0abac5891a55040381ee",
"yaml_edit_rev": "54884db790720ac0f7ca491cb9e6d7a0395ad4cb",
"yaml_rev": "5a1c4be2437bc4122ccf08a3a0f06a7683e62f30",
"yaml_edit_rev": "f5a92b3bc64b4e78ec1fb616ad1dff2174e799b1",

# Windows deps
"crashpad_rev": "bf327d8ceb6a669607b0dbab5a83a275d03f99ed",
Expand Down
12 changes: 12 additions & 0 deletions pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5160,6 +5160,18 @@ const MessageCode messageExtendsVoid = const MessageCode(
problemMessage: r"""The type 'void' can't be used in an 'extends' clause.""",
);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeExtensionAugmentationHasOnClause =
messageExtensionAugmentationHasOnClause;

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageExtensionAugmentationHasOnClause = const MessageCode(
"ExtensionAugmentationHasOnClause",
index: 179,
problemMessage: r"""Extension augmentations can't have 'on' clauses.""",
correctionMessage: r"""Try removing the 'on' clause.""",
);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeExtensionDeclaresAbstractMember =
messageExtensionDeclaresAbstractMember;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ class ForwardingListener implements Listener {

@override
void endExtensionDeclaration(Token beginToken, Token extensionKeyword,
Token onKeyword, Token endToken) {
Token? onKeyword, Token endToken) {
listener?.endExtensionDeclaration(
beginToken, extensionKeyword, onKeyword, endToken);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class Listener implements UnescapeErrorListener {
/// - on type
/// - body
void endExtensionDeclaration(Token beginToken, Token extensionKeyword,
Token onKeyword, Token endToken) {
Token? onKeyword, Token endToken) {
logEvent('ExtensionDeclaration');
}

Expand Down
38 changes: 26 additions & 12 deletions pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3106,22 +3106,36 @@ class Parser {
token = computeTypeParamOrArg(token, /* inDeclaration = */ true)
.parseVariables(token, this);
listener.beginExtensionDeclaration(augmentToken, extensionKeyword, name);
Token onKeyword = token.next!;
if (!optional('on', onKeyword)) {
// Recovery
if (optional('extends', onKeyword) ||
optional('implements', onKeyword) ||
optional('with', onKeyword)) {
reportRecoverableError(
onKeyword, codes.templateExpectedInstead.withArguments('on'));

Token? onKeyword = token.next!;
if (augmentToken != null) {
if (!optional('on', onKeyword)) {
// Extension augmentations should not provide `on` clauses.
onKeyword = null;
} else {
// If `on` clause is provided, report, but parse it.
reportRecoverableError(
token, codes.templateExpectedAfterButGot.withArguments('on'));
onKeyword = rewriter.insertSyntheticKeyword(token, Keyword.ON);
onKeyword, codes.messageExtensionAugmentationHasOnClause);
TypeInfo typeInfo = computeType(onKeyword, /* required = */ true);
token = typeInfo.ensureTypeOrVoid(onKeyword, this);
}
} else {
if (!optional('on', onKeyword)) {
// Recovery
if (optional('extends', onKeyword) ||
optional('implements', onKeyword) ||
optional('with', onKeyword)) {
reportRecoverableError(
onKeyword, codes.templateExpectedInstead.withArguments('on'));
} else {
reportRecoverableError(
token, codes.templateExpectedAfterButGot.withArguments('on'));
onKeyword = rewriter.insertSyntheticKeyword(token, Keyword.ON);
}
}
TypeInfo typeInfo = computeType(onKeyword, /* required = */ true);
token = typeInfo.ensureTypeOrVoid(onKeyword, this);
}
TypeInfo typeInfo = computeType(onKeyword, /* required = */ true);
token = typeInfo.ensureTypeOrVoid(onKeyword, this);

if (!optional('{', token.next!)) {
// Recovery
Expand Down
13 changes: 8 additions & 5 deletions pkg/analysis_server/lib/src/computer/computer_highlights.dart
Original file line number Diff line number Diff line change
Expand Up @@ -881,17 +881,20 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {

@override
void visitExtensionDeclaration(ExtensionDeclaration node) {
// TODO(brianwilkerson): Uncomment the following lines when the token is
// supported.
// computer._addRegion_token(
// node.augmentKeyword, HighlightRegionType.BUILT_IN);
computer._addRegion_token(
node.augmentKeyword, HighlightRegionType.BUILT_IN);
computer._addRegion_token(
node.extensionKeyword, HighlightRegionType.KEYWORD);
computer._addRegion_token(node.name, HighlightRegionType.EXTENSION);
computer._addRegion_token(node.onKeyword, HighlightRegionType.BUILT_IN);
super.visitExtensionDeclaration(node);
}

@override
void visitExtensionOnClause(ExtensionOnClause node) {
computer._addRegion_token(node.onKeyword, HighlightRegionType.BUILT_IN);
super.visitExtensionOnClause(node);
}

@override
void visitExtensionOverride(ExtensionOverride node) {
computer._addRegion_token(
Expand Down
12 changes: 9 additions & 3 deletions pkg/analysis_server/lib/src/computer/computer_outline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,21 @@ class DartUnitOutlineComputer {
ExtensionDeclaration node, List<Outline> extensionContents) {
var nameToken = node.name;
var name = nameToken?.lexeme ?? '';

Location? location;
if (nameToken != null) {
location = _getLocationToken(nameToken);
} else if (node.onClause case var onClause?) {
location = _getLocationNode(onClause.extendedType);
}

var element = Element(
ElementKind.EXTENSION,
name,
Element.makeFlags(
isPrivate: Identifier.isPrivateName(name),
isDeprecated: _isDeprecated(node)),
location: nameToken != null
? _getLocationToken(nameToken)
: _getLocationNode(node.extendedType),
location: location,
typeParameters: _getTypeParametersStr(node.typeParameters));
return _nodeOutline(node, element, extensionContents);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CompletionState {
return element.thisType;
}
case ExtensionDeclaration():
return node.extendedType.type;
return node.onClause?.extendedType.type;
case MixinDeclaration():
var element = node.declaredElement;
if (element != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1075,11 +1075,10 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
identifierHelper(includePrivateIdentifiers: false).addTopLevelName();
}
if (offset <= node.leftBracket.offset) {
if (node.onKeyword.isSynthetic) {
keywordHelper.addExtensionDeclarationKeywords(node);
} else {
collector.completionLocation = 'ExtensionDeclaration_extendedType';
_forTypeAnnotation(node);
if (node.onClause case var onClause?) {
if (onClause.onKeyword.isSynthetic) {
keywordHelper.addExtensionDeclarationKeywords(node);
}
}
return;
}
Expand All @@ -1089,6 +1088,17 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
}
}

@override
void visitExtensionOnClause(ExtensionOnClause node) {
if (offset <= node.onKeyword.end) {
keywordHelper.addKeyword(Keyword.ON);
return;
}

collector.completionLocation = 'ExtensionOnClause_extendedType';
_forTypeAnnotation(node);
}

@override
void visitExtensionOverride(ExtensionOverride node) {
_forExpression(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ class KeywordHelper {
/// extension declaration between the name of the extension and the body. The
/// [node] is the extension declaration containing the selection point.
void addExtensionDeclarationKeywords(ExtensionDeclaration node) {
if (node.onKeyword.isSynthetic) {
var onClause = node.onClause;
if (onClause == null || onClause.onKeyword.isSynthetic) {
addKeyword(Keyword.ON);
if (node.name == null && featureSet.isEnabled(Feature.inline_class)) {
addText('type');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class ImportLibrary extends MultiCorrectionProducer {
if (parent is ClassDeclaration) {
return parent.declaredElement?.thisType;
} else if (parent is ExtensionDeclaration) {
return parent.extendedType.type;
return parent.onClause?.extendedType.type;
} else if (parent is MixinDeclaration) {
return parent.declaredElement?.thisType;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2778,6 +2778,10 @@ ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE:
status: needsFix
notes: |-
Move the directive to a valid place.
ParserErrorCode.EXTENSION_AUGMENTATION_HAS_ON_CLAUSE:
status: needsFix
notes: |-
Remove the 'on' clause.
ParserErrorCode.EXTENSION_DECLARES_ABSTRACT_MEMBER:
status: needsFix
notes: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:analysis_server/src/utilities/strings.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/precedence.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/source/source_range.dart';
Expand Down Expand Up @@ -572,6 +573,12 @@ class _ReferenceProcessor {
}
// do replace
var methodUsageRange = range.node(usage);
var awaitKeyword = Keyword.AWAIT.lexeme;
if (usage.parent is AwaitExpression &&
source.startsWith(awaitKeyword)) {
// remove the duplicate await keyword and the following whitespace.
source = source.substring(awaitKeyword.length + 1);
}
var edit = newSourceEdit_range(methodUsageRange, source);
_addRefEdit(edit);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,6 @@ augment enum E {a, b}
assertHasRegion(HighlightRegionType.BUILT_IN, 'augment');
}

@SkippedTest(reason: 'The token is not supported')
Future<void> test_BUILT_IN_augment_onExtension() async {
addTestFile('''
augment extension on int {}
''');
await prepareHighlights();
assertHasRegion(HighlightRegionType.BUILT_IN, 'augment');
}

Future<void> test_BUILT_IN_augment_onImport() async {
addTestFile('''
import augment 'a.dart';
Expand Down Expand Up @@ -1254,6 +1245,34 @@ void f() {
assertHasRegion(HighlightRegionType.EXTENSION, 'E.bar()');
}

Future<void> test_extension_augment() async {
final testCode = TestCode.parse(r'''
augment extension E {}
''');
addTestFile(testCode.code);
await prepareHighlights();
assertHighlightText(testCode, -1, r'''
0 + 7 |augment| BUILT_IN
8 + 9 |extension| KEYWORD
18 + 1 |E| EXTENSION
''');
}

Future<void> test_extension_augment_hasOnClause() async {
final testCode = TestCode.parse(r'''
augment extension E on int {}
''');
addTestFile(testCode.code);
await prepareHighlights();
assertHighlightText(testCode, -1, r'''
0 + 7 |augment| BUILT_IN
8 + 9 |extension| KEYWORD
18 + 1 |E| EXTENSION
20 + 2 |on| BUILT_IN
23 + 3 |int| CLASS
''');
}

Future<void> test_extensionType() async {
final testCode = TestCode.parse(r'''
extension type const A<T>.named(int it) implements num {}
Expand Down
Loading

0 comments on commit 88a81dd

Please sign in to comment.