Version 2.17.0-210.0.dev
Merge commit '37e67cccfab6f07347c4cb3207b9abec67b26108' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index be5981de..192da24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -103,9 +103,11 @@
#### Linter
-Updated the Linter to `1.19.2`, which includes changes that
+Updated the Linter to `1.20.0`, which includes changes that
-- adds new lint: `use_super_initializers`.
+- fixes `unnecessary_null_aware_assignments` property-access
+ false positives.
+- adds new lint: `use_super_parameters`.
- adds new lint: `use_enums`.
- adds new lint: `use_colored_box`.
- improves performance for `sort_constructors`.
diff --git a/DEPS b/DEPS
index 0258c53..c0ff65e 100644
--- a/DEPS
+++ b/DEPS
@@ -124,7 +124,7 @@
"intl_tag": "9669926609e7efc17dfd74fbb44ec719a7e573cc", # 0.17.0-nullsafety
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_rev": "7e00f893440a72de0637970325e4ea44bd1e8c8e",
- "linter_tag": "4eaae25b00f3c29935ab0d804b8711cf9a645519", # 1.19.2
+ "linter_tag": "ed26087ae1b54fb8c532fcda618e6bf08827e315", # 1.20.0
"lints_tag": "f9670df2a66e0ec12eb51554e70c1cbf56c8f5d0",
"logging_rev": "dfbe88b890c3b4f7bc06da5a7b3b43e9e263b688",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
diff --git a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
index 9a0d773..86aaeac 100644
--- a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
@@ -3465,8 +3465,6 @@
/// Otherwise `null`.
ReferenceWithType<Variable, Type>? _expressionReference;
- int _functionNestingLevel = 0;
-
final AssignedVariables<Node, Variable> _assignedVariables;
/// Indicates whether initializers of implicitly typed variables should be
@@ -3734,7 +3732,6 @@
void functionExpression_begin(Node node) {
AssignedVariablesNodeInfo<Variable> info =
_assignedVariables._getInfoForNode(node);
- ++_functionNestingLevel;
_current = _current.conservativeJoin(const [], info._written);
_stack.add(new _FunctionExpressionContext(_current));
_current = _current.conservativeJoin(_assignedVariables._anywhere._written,
@@ -3743,8 +3740,6 @@
@override
void functionExpression_end() {
- --_functionNestingLevel;
- assert(_functionNestingLevel >= 0);
_SimpleContext<Variable, Type> context =
_stack.removeLast() as _FunctionExpressionContext<Variable, Type>;
_current = context._previous;
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor/executor_base.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor/executor_base.dart
index 940fa5a..b592139 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor/executor_base.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor/executor_base.dart
@@ -147,15 +147,35 @@
case MessageType.declarationOfRequest:
DeclarationOfRequest request =
new DeclarationOfRequest.deserialize(deserializer, zoneId);
- TypeDeclarationResolver resolver = request
- .typeDeclarationResolver.instance as TypeDeclarationResolver;
- SerializableResponse response = new SerializableResponse(
- requestId: request.id,
- responseType: MessageType.remoteInstance,
- response: (await resolver.declarationOf(request.identifier)
- // TODO: Consider refactoring to avoid the need for this.
- as TypeDeclarationImpl),
- serializationZoneId: zoneId);
+ SerializableResponse response;
+ try {
+ TypeDeclarationResolver resolver = request
+ .typeDeclarationResolver
+ .instance as TypeDeclarationResolver;
+ response = new SerializableResponse(
+ requestId: request.id,
+ responseType: MessageType.remoteInstance,
+ response: (await resolver.declarationOf(request.identifier)
+ // TODO: Consider refactoring to avoid the need for
+ // this.
+ as TypeDeclarationImpl),
+ serializationZoneId: zoneId);
+ } on ArgumentError catch (error) {
+ response = new SerializableResponse(
+ error: '$error',
+ requestId: request.id,
+ responseType: MessageType.argumentError,
+ serializationZoneId: zoneId);
+ } catch (error, stackTrace) {
+ // TODO(johnniwinther,jakemac): How should we handle errors in
+ // general?
+ response = new SerializableResponse(
+ error: '$error',
+ stackTrace: '$stackTrace',
+ requestId: request.id,
+ responseType: MessageType.error,
+ serializationZoneId: zoneId);
+ }
Serializer serializer = serializerFactory();
response.serialize(serializer);
sendResult(serializer);
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor/protocol.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor/protocol.dart
index 73d051c6..ccdee90 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor/protocol.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor/protocol.dart
@@ -92,6 +92,10 @@
deserializer.moveNext();
stackTrace = deserializer.expectNullableString();
break;
+ case MessageType.argumentError:
+ deserializer.moveNext();
+ error = deserializer.expectString();
+ break;
case MessageType.macroClassIdentifier:
response = new MacroClassIdentifierImpl.deserialize(deserializer);
break;
@@ -140,6 +144,9 @@
serializer.addString(error!.toString());
serializer.addNullableString(stackTrace);
break;
+ case MessageType.argumentError:
+ serializer.addString(error!.toString());
+ break;
default:
response.serializeNullable(serializer);
}
@@ -752,11 +759,15 @@
T _handleResponse<T>(Response response) {
if (response.responseType == MessageType.error) {
throw new RemoteException(response.error!.toString(), response.stackTrace);
+ } else if (response.responseType == MessageType.argumentError) {
+ throw new ArgumentError(response.error!.toString());
}
+
return response.response as T;
}
enum MessageType {
+ argumentError,
boolean,
constructorsOfRequest,
declarationOfRequest,
diff --git a/pkg/_fe_analyzer_shared/test/macros/api/api_test_expectations.dart b/pkg/_fe_analyzer_shared/test/macros/api/api_test_expectations.dart
index fcbb437..8c5a201 100644
--- a/pkg/_fe_analyzer_shared/test/macros/api/api_test_expectations.dart
+++ b/pkg/_fe_analyzer_shared/test/macros/api/api_test_expectations.dart
@@ -84,10 +84,17 @@
}
}
-Future<void> throws(Future<void> Function() f, property) async {
+Future<void> throws(Future<void> Function() f, property,
+ {String? Function(Object)? expectedError}) async {
try {
await f();
- } catch (_) {
+ } catch (e) {
+ if (expectedError != null) {
+ String? errorMessage = expectedError(e);
+ if (errorMessage != null) {
+ throw 'Unexpected exception on $property: $errorMessage';
+ }
+ }
return;
}
throw 'Expected throws on $property';
@@ -244,6 +251,31 @@
await check(macroApiData, 'field=', expectThrows: true);
}
+Future<void> checkTypeDeclarationResolver(
+ TypeDeclarationResolver typeDeclarationResolver,
+ Map<Identifier, String?> test) async {
+ Future<void> check(Identifier identifier, String name,
+ {bool expectThrows: false}) async {
+ if (expectThrows) {
+ await throws(() async {
+ await typeDeclarationResolver.declarationOf(identifier);
+ }, '$name from $identifier',
+ expectedError: (e) => e is! ArgumentError
+ ? 'Expected ArgumentError, got ${e.runtimeType}: $e'
+ : null);
+ } else {
+ TypeDeclaration result =
+ await typeDeclarationResolver.declarationOf(identifier);
+ expect(name, result.identifier.name, '$name from $identifier');
+ }
+ }
+
+ test.forEach((Identifier identifier, String? expectedName) {
+ check(identifier, expectedName ?? identifier.name,
+ expectThrows: expectedName == null);
+ });
+}
+
class ClassData {
final bool isAbstract;
final bool isExternal;
diff --git a/pkg/_fe_analyzer_shared/test/macros/api/api_test_macro.dart b/pkg/_fe_analyzer_shared/test/macros/api/api_test_macro.dart
index d54db3b..3e04aae 100644
--- a/pkg/_fe_analyzer_shared/test/macros/api/api_test_macro.dart
+++ b/pkg/_fe_analyzer_shared/test/macros/api/api_test_macro.dart
@@ -6,8 +6,6 @@
import 'package:_fe_analyzer_shared/src/macros/api.dart';
import 'api_test_expectations.dart';
-
-
macro class ClassMacro
implements ClassTypesMacro, ClassDeclarationsMacro, ClassDefinitionMacro {
const ClassMacro();
@@ -25,6 +23,9 @@
FutureOr<void> buildDefinitionForClass(
ClassDeclaration clazz, ClassDefinitionBuilder builder) async {
await checkClassDeclaration(clazz, classIntrospector: builder);
+ await checkIdentifierResolver(builder);
+ await checkTypeDeclarationResolver(builder,
+ {clazz.identifier : clazz.identifier.name});
}
}
@@ -51,5 +52,6 @@
FunctionDeclaration function, FunctionDefinitionBuilder builder) async {
checkFunctionDeclaration(function);
await checkIdentifierResolver(builder);
+ await checkTypeDeclarationResolver(builder, {function.identifier: null});
}
}
diff --git a/pkg/analysis_server/lib/protocol/protocol.dart b/pkg/analysis_server/lib/protocol/protocol.dart
index 3481a4c..c1d6da7 100644
--- a/pkg/analysis_server/lib/protocol/protocol.dart
+++ b/pkg/analysis_server/lib/protocol/protocol.dart
@@ -310,6 +310,13 @@
/// then the response will represent an error condition.
Response(this.id, {this.result, this.error});
+ /// Initialize a newly created instance to represent the CONTENT_MODIFIED
+ /// error condition.
+ Response.contentModified(Request request)
+ : this(request.id,
+ error: RequestError(RequestErrorCode.CONTENT_MODIFIED,
+ 'File was modified before the operation completed.'));
+
/// Create and return the `DEBUG_PORT_COULD_NOT_BE_OPENED` error response.
Response.debugPortCouldNotBeOpened(Request request, dynamic error)
: this(request.id,
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index b4c545a..0279042 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -44,6 +44,7 @@
import 'package:analysis_server/src/utilities/progress.dart';
import 'package:analysis_server/src/utilities/request_statistics.dart';
import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
@@ -301,6 +302,9 @@
sendResponse(response);
return;
}
+ } on InconsistentAnalysisException {
+ sendResponse(Response.contentModified(request));
+ return;
} on RequestFailure catch (exception) {
sendResponse(exception.response);
return;
diff --git a/pkg/analysis_server/lib/src/analysis_server_abstract.dart b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
index 65f35a6..e3e804f 100644
--- a/pkg/analysis_server/lib/src/analysis_server_abstract.dart
+++ b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
@@ -407,6 +407,9 @@
}
/// Return the unresolved unit for the file with the given [path].
+ ///
+ /// Callers should handle [InconsistentAnalysisException] exceptions that may
+ /// occur if a file is modified during this operation.
Future<ParsedUnitResult?> getParsedUnit(String path) async {
if (!file_paths.isDart(resourceProvider.pathContext, path)) {
return null;
@@ -417,12 +420,8 @@
return null;
}
- try {
- var result = await session.getParsedUnit2(path);
- return result is ParsedUnitResult ? result : null;
- } on InconsistentAnalysisException {
- return null;
- }
+ var result = await session.getParsedUnit2(path);
+ return result is ParsedUnitResult ? result : null;
}
/// Return the resolved unit for the file with the given [path]. The file is
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart
index 4de8bfe..5523d17 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart
@@ -13,7 +13,6 @@
import 'package:analysis_server/src/protocol_server.dart';
import 'package:analysis_server/src/services/refactoring/refactoring.dart';
import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
@@ -98,8 +97,6 @@
final edit = createWorkspaceEdit(server, change);
return await sendWorkspaceEditToClient(edit);
- } on InconsistentAnalysisException {
- return fileModifiedError;
} finally {
_manager.end(cancelableToken);
reporter.end();
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index d0300bb..12284b0 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -38,6 +38,7 @@
import 'package:analysis_server/src/utilities/process.dart';
import 'package:analyzer/dart/analysis/context_locator.dart';
import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
@@ -355,6 +356,13 @@
} else {
showErrorMessageToUser('Unknown message type');
}
+ } on InconsistentAnalysisException {
+ sendErrorResponse(
+ message,
+ ResponseError(
+ code: ErrorCodes.ContentModified,
+ message: 'Document was modified before operation completed',
+ ));
} catch (error, stackTrace) {
final errorMessage = message is ResponseMessage
? 'An error occurred while handling the response to request ${message.id}'
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart
index 7f84f01..4fe011b 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart
@@ -4,6 +4,7 @@
import 'package:analysis_server/src/services/correction/assist.dart';
import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analysis_server/src/utilities/extensions/range_factory.dart';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
@@ -11,6 +12,7 @@
import 'package:analyzer/source/source_range.dart';
import 'package:analyzer_plugin/utilities/assist/assist.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:analyzer_plugin/utilities/range_factory.dart';
class ConvertToSuperParameters extends CorrectionProducer {
@@ -18,6 +20,18 @@
AssistKind get assistKind => DartAssistKind.CONVERT_TO_SUPER_PARAMETERS;
@override
+ bool get canBeAppliedInBulk => true;
+
+ @override
+ bool get canBeAppliedToFile => true;
+
+ @override
+ FixKind get fixKind => DartFixKind.CONVERT_TO_SUPER_PARAMETERS;
+
+ @override
+ FixKind? get multiFixKind => DartFixKind.CONVERT_TO_SUPER_PARAMETERS_MULTI;
+
+ @override
Future<void> compute(ChangeBuilder builder) async {
if (!libraryElement.featureSet.isEnabled(Feature.super_parameters)) {
// If the library doesn't support super_parameters then the change isn't
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index a2be51b..c3c7bc1 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -1842,8 +1842,8 @@
status: needsEvaluation
LintCode.use_string_buffers:
status: needsEvaluation
-LintCode.use_super_initializers:
- status: needsFix
+LintCode.use_super_parameters:
+ status: hasFix
LintCode.use_test_throws_matchers:
status: needsEvaluation
LintCode.use_to_and_as_if_applicable:
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index d5879e9..f55d3ca 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -568,6 +568,16 @@
DartFixKindPriority.IN_FILE,
'Convert to spreads everywhere in file',
);
+ static const CONVERT_TO_SUPER_PARAMETERS = FixKind(
+ 'dart.fix.convert.toSuperParameters',
+ 30,
+ 'Convert to using super parameters',
+ );
+ static const CONVERT_TO_SUPER_PARAMETERS_MULTI = FixKind(
+ 'dart.fix.convert.toSuperParameters.multi',
+ 30,
+ 'Convert to using super parameters everywhere in file',
+ );
static const CONVERT_TO_WHERE_TYPE = FixKind(
'dart.fix.convert.toWhereType',
DartFixKindPriority.DEFAULT,
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 50e70815..10fc9e5 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -65,6 +65,7 @@
import 'package:analysis_server/src/services/correction/dart/convert_to_raw_string.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_relative_import.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_set_literal.dart';
+import 'package:analysis_server/src/services/correction/dart/convert_to_super_parameters.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_where_type.dart';
import 'package:analysis_server/src/services/correction/dart/create_class.dart';
import 'package:analysis_server/src/services/correction/dart/create_constructor.dart';
@@ -674,6 +675,9 @@
LintNames.use_rethrow_when_possible: [
UseRethrow.newInstance,
],
+ LintNames.use_super_parameters: [
+ ConvertToSuperParameters.newInstance,
+ ],
};
/// A map from error codes to a list of generators used to create multiple
diff --git a/pkg/analysis_server/lib/src/services/linter/lint_names.dart b/pkg/analysis_server/lib/src/services/linter/lint_names.dart
index 108dde5..60448e7 100644
--- a/pkg/analysis_server/lib/src/services/linter/lint_names.dart
+++ b/pkg/analysis_server/lib/src/services/linter/lint_names.dart
@@ -158,4 +158,5 @@
'use_key_in_widget_constructors';
static const String use_raw_strings = 'use_raw_strings';
static const String use_rethrow_when_possible = 'use_rethrow_when_possible';
+ static const String use_super_parameters = 'use_super_parameters';
}
diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/dart_snippet_producers.dart b/pkg/analysis_server/lib/src/services/snippets/dart/dart_snippet_producers.dart
index 016b2f7..19b2fc3c 100644
--- a/pkg/analysis_server/lib/src/services/snippets/dart/dart_snippet_producers.dart
+++ b/pkg/analysis_server/lib/src/services/snippets/dart/dart_snippet_producers.dart
@@ -26,7 +26,7 @@
builder.addReplacement(request.replacementRange, (builder) {
void writeIndented(String string) => builder.write('$indent$string');
builder.write('class ');
- builder.addEmptyLinkedEdit('className');
+ builder.addSimpleLinkedEdit('className', 'ClassName');
builder.writeln(' {');
writeIndented(' ');
builder.selectHere();
@@ -67,7 +67,7 @@
builder.selectHere();
builder.writeln();
writeIndented('} while (');
- builder.addEmptyLinkedEdit('expression');
+ builder.addSimpleLinkedEdit('condition', 'condition');
builder.write(');');
});
});
@@ -103,9 +103,9 @@
builder.addReplacement(request.replacementRange, (builder) {
void writeIndented(String string) => builder.write('$indent$string');
builder.write('for ($varOrFinal ');
- builder.addEmptyLinkedEdit('variableName');
+ builder.addSimpleLinkedEdit('elementName', 'element');
builder.write(' in ');
- builder.addEmptyLinkedEdit('collectionName');
+ builder.addSimpleLinkedEdit('collectionName', 'collection');
builder.writeln(') {');
writeIndented(' ');
builder.selectHere();
@@ -142,7 +142,7 @@
builder.addReplacement(request.replacementRange, (builder) {
void writeIndented(String string) => builder.write('$indent$string');
builder.write('for (var i = 0; i < ');
- builder.addEmptyLinkedEdit('count');
+ builder.addSimpleLinkedEdit('count', 'count');
builder.writeln('; i++) {');
writeIndented(' ');
builder.selectHere();
@@ -181,7 +181,7 @@
void writeIndentedln(String string) =>
builder.writeln('$indent$string');
builder.write('if (');
- builder.addEmptyLinkedEdit('condition');
+ builder.addSimpleLinkedEdit('condition', 'condition');
builder.writeln(') {');
writeIndented(' ');
builder.selectHere();
@@ -220,7 +220,7 @@
builder.addReplacement(request.replacementRange, (builder) {
void writeIndented(String string) => builder.write('$indent$string');
builder.write('if (');
- builder.addEmptyLinkedEdit('condition');
+ builder.addSimpleLinkedEdit('condition', 'condition');
builder.writeln(') {');
writeIndented(' ');
builder.selectHere();
@@ -336,10 +336,10 @@
void writeIndentedln(String string) =>
builder.writeln('$indent$string');
builder.write('switch (');
- builder.addEmptyLinkedEdit('expression');
+ builder.addSimpleLinkedEdit('expression', 'expression');
builder.writeln(') {');
writeIndented(' case ');
- builder.addEmptyLinkedEdit('value');
+ builder.addSimpleLinkedEdit('value', 'value');
builder.writeln(':');
writeIndented(' ');
builder.selectHere();
@@ -378,7 +378,7 @@
builder.addReplacement(request.replacementRange, (builder) {
void writeIndented(String string) => builder.write('$indent$string');
builder.write("test('");
- builder.addEmptyLinkedEdit('testName');
+ builder.addSimpleLinkedEdit('testName', 'test name');
builder.writeln("', () {");
writeIndented(' ');
builder.selectHere();
@@ -425,7 +425,7 @@
builder.addReplacement(request.replacementRange, (builder) {
void writeIndented(String string) => builder.write('$indent$string');
builder.write("group('");
- builder.addEmptyLinkedEdit('groupName');
+ builder.addSimpleLinkedEdit('groupName', 'group name');
builder.writeln("', () {");
writeIndented(' ');
builder.selectHere();
@@ -515,7 +515,7 @@
builder.addReplacement(request.replacementRange, (builder) {
void writeIndented(String string) => builder.write('$indent$string');
builder.write('while (');
- builder.addEmptyLinkedEdit('expression');
+ builder.addSimpleLinkedEdit('condition', 'condition');
builder.writeln(') {');
writeIndented(' ');
builder.selectHere();
diff --git a/pkg/analysis_server/test/lsp/completion_dart_test.dart b/pkg/analysis_server/test/lsp/completion_dart_test.dart
index 4647afd..6ea5f28 100644
--- a/pkg/analysis_server/test/lsp/completion_dart_test.dart
+++ b/pkg/analysis_server/test/lsp/completion_dart_test.dart
@@ -2383,7 +2383,7 @@
);
expect(updated, r'''
-class $1 {
+class ${1:ClassName} {
$0
}
''');
@@ -2428,7 +2428,7 @@
void f() {
do {
$0
- } while ($1);
+ } while (${1:condition});
}
''');
}
@@ -2466,7 +2466,7 @@
expect(updated, r'''
void f() {
- for (var i = 0; i < $1; i++) {
+ for (var i = 0; i < ${1:count}; i++) {
$0
}
}
@@ -2489,7 +2489,7 @@
expect(updated, r'''
void f() {
- for (var $1 in $2) {
+ for (var ${1:element} in ${2:collection}) {
$0
}
}
@@ -2512,7 +2512,7 @@
expect(updated, r'''
void f() {
- if ($1) {
+ if (${1:condition}) {
$0
}
}
@@ -2535,7 +2535,7 @@
expect(updated, r'''
void f() {
- if ($1) {
+ if (${1:condition}) {
$0
} else {
@@ -2598,8 +2598,8 @@
expect(updated, r'''
void f() {
- switch ($1) {
- case $2:
+ switch (${1:expression}) {
+ case ${2:value}:
$0
break;
default:
@@ -2626,7 +2626,7 @@
expect(updated, r'''
void f() {
- test('$1', () {
+ test('${1:test name}', () {
$0
});
}
@@ -2651,7 +2651,7 @@
expect(updated, r'''
void f() {
- group('$1', () {
+ group('${1:group name}', () {
$0
});
}
@@ -2699,7 +2699,7 @@
expect(updated, r'''
void f() {
- while ($1) {
+ while (${1:condition}) {
$0
}
}
diff --git a/pkg/analysis_server/test/services/snippets/dart/dart_snippet_producers_test.dart b/pkg/analysis_server/test/services/snippets/dart/dart_snippet_producers_test.dart
index 15df536..70374d3 100644
--- a/pkg/analysis_server/test/services/snippets/dart/dart_snippet_producers_test.dart
+++ b/pkg/analysis_server/test/services/snippets/dart/dart_snippet_producers_test.dart
@@ -56,19 +56,19 @@
expect(code, '''
class A {}
-class {
+class ClassName {
}
class B {}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 25);
+ expect(snippet.change.selection!.offset, 34);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 20},
],
- 'length': 0,
+ 'length': 9,
'suggestions': []
}
]);
@@ -86,7 +86,7 @@
@override
String get prefix => DartDoWhileLoopSnippetProducer.prefix;
- Future<void> test_for() async {
+ Future<void> test_do() async {
var code = r'''
void f() {
do^
@@ -102,7 +102,7 @@
void f() {
do {
- } while ();
+ } while (condition);
}''');
expect(snippet.change.selection!.file, testFile);
expect(snippet.change.selection!.offset, 22);
@@ -111,7 +111,7 @@
'positions': [
{'file': testFile, 'offset': 34},
],
- 'length': 0,
+ 'length': 9,
'suggestions': []
}
]);
@@ -143,25 +143,25 @@
.forEach((edit) => code = SourceEdit.applySequence(code, edit.edits));
expect(code, '''
void f() {
- for (var in ) {
+ for (var element in collection) {
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 34);
+ expect(snippet.change.selection!.offset, 51);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 22},
],
- 'length': 0,
+ 'length': 7,
'suggestions': []
},
{
'positions': [
- {'file': testFile, 'offset': 26},
+ {'file': testFile, 'offset': 33},
],
- 'length': 0,
+ 'length': 10,
'suggestions': []
}
]);
@@ -193,18 +193,18 @@
.forEach((edit) => code = SourceEdit.applySequence(code, edit.edits));
expect(code, '''
void f() {
- for (var i = 0; i < ; i++) {
+ for (var i = 0; i < count; i++) {
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 46);
+ expect(snippet.change.selection!.offset, 51);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 33},
],
- 'length': 0,
+ 'length': 5,
'suggestions': []
}
]);
@@ -236,20 +236,20 @@
.forEach((edit) => code = SourceEdit.applySequence(code, edit.edits));
expect(code, '''
void f() {
- if () {
+ if (condition) {
} else {
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 25);
+ expect(snippet.change.selection!.offset, 34);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 17},
],
- 'length': 0,
+ 'length': 9,
'suggestions': []
}
]);
@@ -272,7 +272,7 @@
expect(code, '''
void f() {
if (true) {
- if () {
+ if (condition) {
} else {
@@ -280,13 +280,13 @@
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 43);
+ expect(snippet.change.selection!.offset, 52);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 33},
],
- 'length': 0,
+ 'length': 9,
'suggestions': []
}
]);
@@ -318,18 +318,18 @@
.forEach((edit) => code = SourceEdit.applySequence(code, edit.edits));
expect(code, '''
void f() {
- if () {
+ if (condition) {
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 25);
+ expect(snippet.change.selection!.offset, 34);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 17},
],
- 'length': 0,
+ 'length': 9,
'suggestions': []
}
]);
@@ -352,19 +352,19 @@
expect(code, '''
void f() {
if (true) {
- if () {
+ if (condition) {
}
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 43);
+ expect(snippet.change.selection!.offset, 52);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 33},
],
- 'length': 0,
+ 'length': 9,
'suggestions': []
}
]);
@@ -496,30 +496,30 @@
.forEach((edit) => code = SourceEdit.applySequence(code, edit.edits));
expect(code, '''
void f() {
- switch () {
- case :
+ switch (expression) {
+ case value:
break;
default:
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 42);
+ expect(snippet.change.selection!.offset, 57);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
// expression
{
'positions': [
{'file': testFile, 'offset': 21},
],
- 'length': 0,
+ 'length': 10,
'suggestions': []
},
// value
{
'positions': [
- {'file': testFile, 'offset': 34},
+ {'file': testFile, 'offset': 44},
],
- 'length': 0,
+ 'length': 5,
'suggestions': []
},
]);
@@ -542,8 +542,8 @@
expect(code, '''
void f() {
if (true) {
- switch () {
- case :
+ switch (expression) {
+ case value:
break;
default:
@@ -551,22 +551,22 @@
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 62);
+ expect(snippet.change.selection!.offset, 77);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
// expression
{
'positions': [
{'file': testFile, 'offset': 37},
],
- 'length': 0,
+ 'length': 10,
'suggestions': []
},
// value
{
'positions': [
- {'file': testFile, 'offset': 52},
+ {'file': testFile, 'offset': 62},
],
- 'length': 0,
+ 'length': 5,
'suggestions': []
},
]);
@@ -599,18 +599,18 @@
.forEach((edit) => code = SourceEdit.applySequence(code, edit.edits));
expect(code, '''
void f() {
- test('', () {
+ test('test name', () {
});
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 31);
+ expect(snippet.change.selection!.offset, 40);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 19},
],
- 'length': 0,
+ 'length': 9,
'suggestions': []
}
]);
@@ -651,18 +651,18 @@
.forEach((edit) => code = SourceEdit.applySequence(code, edit.edits));
expect(code, '''
void f() {
- group('', () {
+ group('group name', () {
});
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 32);
+ expect(snippet.change.selection!.offset, 42);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 20},
],
- 'length': 0,
+ 'length': 10,
'suggestions': []
}
]);
@@ -770,7 +770,7 @@
@override
String get prefix => DartWhileLoopSnippetProducer.prefix;
- Future<void> test_for() async {
+ Future<void> test_while() async {
var code = r'''
void f() {
while^
@@ -784,18 +784,18 @@
.forEach((edit) => code = SourceEdit.applySequence(code, edit.edits));
expect(code, '''
void f() {
- while () {
+ while (condition) {
}
}''');
expect(snippet.change.selection!.file, testFile);
- expect(snippet.change.selection!.offset, 28);
+ expect(snippet.change.selection!.offset, 37);
expect(snippet.change.linkedEditGroups.map((group) => group.toJson()), [
{
'positions': [
{'file': testFile, 'offset': 20},
],
- 'length': 0,
+ 'length': 9,
'suggestions': []
}
]);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_super_parameters_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_super_parameters_test.dart
new file mode 100644
index 0000000..b8517d5
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_super_parameters_test.dart
@@ -0,0 +1,492 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/services/linter/lint_names.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'fix_processor.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(ConvertToSuperParametersBulkTest);
+ defineReflectiveTests(ConvertToSuperParametersTest);
+ });
+}
+
+@reflectiveTest
+class ConvertToSuperParametersBulkTest extends BulkFixProcessorTest {
+ @override
+ String get lintCode => LintNames.use_super_parameters;
+
+ Future<void> test_singleFile() async {
+ await resolveTestCode('''
+class A {
+ A.m({int? x});
+ A.n(int x);
+}
+class B extends A {
+ B.m({int? x}) : super.m(x: x);
+ B.n(int x) : super.n(x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A.m({int? x});
+ A.n(int x);
+}
+class B extends A {
+ B.m({super.x}) : super.m();
+ B.n(super.x) : super.n();
+}
+''');
+ }
+}
+
+@reflectiveTest
+class ConvertToSuperParametersTest extends FixProcessorLintTest {
+ @override
+ FixKind get kind => DartFixKind.CONVERT_TO_SUPER_PARAMETERS;
+
+ @override
+ String get lintCode => LintNames.use_super_parameters;
+
+ Future<void> test_defaultValue_different_named() async {
+ await resolveTestCode('''
+class A {
+ A({int x = 0});
+}
+class B extends A {
+ B({int x = 2}) : super(x: x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A({int x = 0});
+}
+class B extends A {
+ B({super.x = 2});
+}
+''');
+ }
+
+ Future<void> test_defaultValue_different_positional() async {
+ await resolveTestCode('''
+class A {
+ A([int x = 0]);
+}
+class B extends A {
+ B([int x = 2]) : super(x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A([int x = 0]);
+}
+class B extends A {
+ B([super.x = 2]);
+}
+''');
+ }
+
+ Future<void> test_defaultValue_equal_named() async {
+ await resolveTestCode('''
+class A {
+ A({int x = 0});
+}
+class B extends A {
+ B({int x = 0}) : super(x: x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A({int x = 0});
+}
+class B extends A {
+ B({super.x});
+}
+''');
+ }
+
+ Future<void> test_defaultValue_equal_positional() async {
+ await resolveTestCode('''
+class A {
+ A([int x = 0]);
+}
+class B extends A {
+ B([int x = 0]) : super(x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A([int x = 0]);
+}
+class B extends A {
+ B([super.x]);
+}
+''');
+ }
+
+ Future<void> test_mixed_first() async {
+ await resolveTestCode('''
+class A {
+ A(int x, {int? y});
+}
+class B extends A {
+ B(int x, int y) : super(x, y: y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x, {int? y});
+}
+class B extends A {
+ B(super.x, int y) : super(y: y);
+}
+''');
+ }
+
+ Future<void> test_mixed_last() async {
+ await resolveTestCode('''
+class A {
+ A(int x, {int? y});
+}
+class B extends A {
+ B(int y, int x) : super(x, y: y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x, {int? y});
+}
+class B extends A {
+ B(int y, super.x) : super(y: y);
+}
+''');
+ }
+
+ Future<void> test_mixed_middle() async {
+ await resolveTestCode('''
+class A {
+ A(int y, {int? z});
+}
+class B extends A {
+ B(int x, int y, int z) : super(y, z: z);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int y, {int? z});
+}
+class B extends A {
+ B(int x, super.y, int z) : super(z: z);
+}
+''');
+ }
+
+ Future<void> test_named_all_reversedOrder() async {
+ await resolveTestCode('''
+class A {
+ A({int? x, int? y});
+}
+class B extends A {
+ B({int? y, int? x}) : super(x: x, y: y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A({int? x, int? y});
+}
+class B extends A {
+ B({super.y, super.x});
+}
+''');
+ }
+
+ Future<void> test_named_all_sameOrder() async {
+ await resolveTestCode('''
+class A {
+ A({int? x, int? y});
+}
+class B extends A {
+ B({int? x, int? y}) : super(x: x, y: y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A({int? x, int? y});
+}
+class B extends A {
+ B({super.x, super.y});
+}
+''');
+ }
+
+ Future<void> test_named_first() async {
+ await resolveTestCode('''
+class A {
+ A({int? x, int? y});
+}
+class B extends A {
+ B({int? x, required int y}) : super(x: x, y: y + 1);
+}
+''');
+ await assertHasFix('''
+class A {
+ A({int? x, int? y});
+}
+class B extends A {
+ B({super.x, required int y}) : super(y: y + 1);
+}
+''');
+ }
+
+ Future<void> test_named_last() async {
+ await resolveTestCode('''
+class A {
+ A({int? x, int? y});
+}
+class B extends A {
+ B({required int x, int? y}) : super(x: x + 1, y: y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A({int? x, int? y});
+}
+class B extends A {
+ B({required int x, super.y}) : super(x: x + 1);
+}
+''');
+ }
+
+ Future<void> test_named_middle() async {
+ await resolveTestCode('''
+class A {
+ A({int? x, int? y, int? z});
+}
+class B extends A {
+ B({required int x, int? y, required int z}) : super(x: x + 1, y: y, z: z + 1);
+}
+''');
+ await assertHasFix('''
+class A {
+ A({int? x, int? y, int? z});
+}
+class B extends A {
+ B({required int x, super.y, required int z}) : super(x: x + 1, z: z + 1);
+}
+''');
+ }
+
+ Future<void> test_named_only() async {
+ await resolveTestCode('''
+class A {
+ A({int? x});
+}
+class B extends A {
+ B({int? x}) : super(x: x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A({int? x});
+}
+class B extends A {
+ B({super.x});
+}
+''');
+ }
+
+ Future<void> test_positional_first() async {
+ await resolveTestCode('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B(int x, int y) : super(x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B(super.x, int y);
+}
+''');
+ }
+
+ Future<void> test_positional_functionTypedFormalParameter() async {
+ await resolveTestCode('''
+class A {
+ A(int x(int));
+}
+class B extends A {
+ B(int x(int)) : super(x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x(int));
+}
+class B extends A {
+ B(super.x);
+}
+''');
+ }
+
+ Future<void> test_positional_last() async {
+ await resolveTestCode('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B(int x, int y) : super(y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B(int x, super.y);
+}
+''');
+ }
+
+ Future<void> test_positional_middle() async {
+ await resolveTestCode('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B(int x, int y, int z) : super(y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B(int x, super.y, int z);
+}
+''');
+ }
+
+ Future<void> test_positional_multiple_optional() async {
+ await resolveTestCode('''
+class A {
+ A([int? x, int? y]);
+}
+class B extends A {
+ B([int? x, int? y]) : super(x, y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A([int? x, int? y]);
+}
+class B extends A {
+ B([super.x, super.y]);
+}
+''');
+ }
+
+ Future<void> test_positional_multiple_required() async {
+ await resolveTestCode('''
+class A {
+ A(int x, int y);
+}
+class B extends A {
+ B(int x, int y) : super(x, y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x, int y);
+}
+class B extends A {
+ B(super.x, super.y);
+}
+''');
+ }
+
+ Future<void> test_positional_multiple_requiredAndOptional() async {
+ await resolveTestCode('''
+class A {
+ A(int x, [int? y]);
+}
+class B extends A {
+ B(int x, [int? y]) : super(x, y);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x, [int? y]);
+}
+class B extends A {
+ B(super.x, [super.y]);
+}
+''');
+ }
+
+ Future<void> test_positional_only() async {
+ await resolveTestCode('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B(int x) : super(x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B(super.x);
+}
+''');
+ }
+
+ Future<void> test_positional_only_optional() async {
+ await resolveTestCode('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B([int x = 0]) : super(x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x);
+}
+class B extends A {
+ B([super.x = 0]);
+}
+''');
+ }
+
+ Future<void> test_positional_unpassedOptionalPositional() async {
+ await resolveTestCode('''
+class A {
+ A(int x, [int y = 0]);
+}
+class B extends A {
+ B(int x) : super(x);
+}
+''');
+ await assertHasFix('''
+class A {
+ A(int x, [int y = 0]);
+}
+class B extends A {
+ B(super.x);
+}
+''');
+ }
+}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
index 9478bc2..8bd5f64 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
@@ -82,6 +82,7 @@
import 'convert_to_single_quoted_string_test.dart'
as convert_to_single_quoted_string;
import 'convert_to_spread_test.dart' as convert_to_spread;
+import 'convert_to_super_parameters_test.dart' as convert_to_super_parameters;
import 'convert_to_where_type_test.dart' as convert_to_where_type;
import 'create_class_test.dart' as create_class;
import 'create_constructor_for_final_fields_test.dart'
@@ -293,6 +294,7 @@
convert_to_set_literal.main();
convert_to_single_quoted_string.main();
convert_to_spread.main();
+ convert_to_super_parameters.main();
convert_to_where_type.main();
create_class.main();
create_constructor_for_final_field.main();
diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
index eb43608..a842f66 100644
--- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
@@ -59,9 +59,6 @@
/// The list of type parameters being inferred.
final List<TypeParameterElement> _typeFormals;
- /// Indicates whether type parameter bounds should be included in constraints.
- final bool considerExtendsClause;
-
/// The [ErrorReporter] to which inference errors should be reported, or
/// `null` if errors shouldn't be reported.
final ErrorReporter? errorReporter;
@@ -75,8 +72,7 @@
final bool genericMetadataIsEnabled;
GenericInferrer(this._typeSystem, this._typeFormals,
- {this.considerExtendsClause = true,
- this.errorReporter,
+ {this.errorReporter,
this.errorNode,
required this.genericMetadataIsEnabled}) {
if (errorReporter != null) {
@@ -438,7 +434,7 @@
var typeParam = _typeFormals[i] as TypeParameterElementImpl;
_TypeConstraint? extendsClause;
var bound = typeParam.bound;
- if (considerExtendsClause && bound != null) {
+ if (bound != null) {
extendsClause = _TypeConstraint.fromExtends(
typeParam,
bound,
diff --git a/pkg/analyzer/lib/src/dart/element/type_system.dart b/pkg/analyzer/lib/src/dart/element/type_system.dart
index 10f80f7..e782c15 100644
--- a/pkg/analyzer/lib/src/dart/element/type_system.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_system.dart
@@ -1219,7 +1219,6 @@
}) {
var typeParameters = mixinElement.typeParameters;
var inferrer = GenericInferrer(this, typeParameters,
- considerExtendsClause: false,
genericMetadataIsEnabled: genericMetadataIsEnabled);
for (int i = 0; i < srcTypes.length; i++) {
inferrer.constrainReturnType(srcTypes[i], destTypes[i]);
diff --git a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
index 6e65351..1510042 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
@@ -434,7 +434,11 @@
ErrorReporter _getErrorReporter(FileState file) {
return _errorReporters.putIfAbsent(file, () {
RecordingErrorListener listener = _getErrorListener(file);
- return ErrorReporter(listener, file.source);
+ return ErrorReporter(
+ listener,
+ file.source,
+ isNonNullableByDefault: _libraryElement.isNonNullableByDefault,
+ );
});
}
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index ab875d7..d7b654c 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -363,6 +363,17 @@
''');
}
+ test_errors_hasNullSuffix() {
+ assertErrorsInCode(r'''
+String f(Map<int, String> a) {
+ return a[0];
+}
+''', [
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 40, 4,
+ messageContains: ["'String'", 'String?']),
+ ]);
+ }
+
test_findReferences_class() async {
var aPath = convertPath('/workspace/dart/test/lib/a.dart');
newFile2(aPath, r'''
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
index 646c18a..be0b7fc 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
@@ -359,15 +359,6 @@
SourceEdit get sourceEdit => SourceEdit(offset, length, _buffer.toString());
@override
- void addEmptyLinkedEdit(String groupName) {
- var start = offset + _buffer.length;
- var position = Position(fileEditBuilder.fileEdit.file, start);
- fileEditBuilder.changeBuilder._lockedPositions.add(position);
- var group = fileEditBuilder.changeBuilder.getLinkedEditGroup(groupName);
- group.addPosition(position, 0);
- }
-
- @override
void addLinkedEdit(String groupName,
void Function(LinkedEditBuilder builder) buildLinkedEdit) {
var builder = createLinkedEditBuilder();
diff --git a/pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_core.dart b/pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_core.dart
index b49c38a..804c3c4c 100644
--- a/pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_core.dart
+++ b/pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_core.dart
@@ -75,14 +75,6 @@
///
/// Clients may not extend, implement or mix-in this class.
abstract class EditBuilder {
- /// Add an empty region that is part of the linked edit group with the given
- /// [groupName].
- ///
- /// Empty linked edits are locations where the user expects to be able to tab
- /// to but there is no default (or suggested) text. For example inside the
- /// parens of an `if` statement.
- void addEmptyLinkedEdit(String groupName);
-
/// Add a region of text that is part of the linked edit group with the given
/// [groupName]. The [buildLinkedEdit] function is used to write the content
/// of the region of text and to add suggestions for other possible values for
diff --git a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
index b52e463..fd6eb9b 100644
--- a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
+++ b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
@@ -320,35 +320,6 @@
expect(edit.replacement, equalsIgnoringWhitespace('A(int a, {this.b});'));
}
- Future<void> test_writeEmptyLinkedEditGroup() async {
- var path = convertPath('/home/test/lib/test.dart');
- addSource(path, '');
-
- var builder = await newBuilder();
- await builder.addDartFileEdit(path, (builder) {
- builder.addInsertion(0, (builder) {
- builder.write('if (');
- builder.addEmptyLinkedEdit('condition');
- builder.writeln(') {');
- builder.write(' ');
- builder.addEmptyLinkedEdit('body');
- builder.writeln();
- builder.writeln('}');
- });
- });
-
- var linkedEditGroups = builder.sourceChange.linkedEditGroups;
- expect(linkedEditGroups, hasLength(2));
- // inside parens at `if ()`
- expect(linkedEditGroups[0].length, 0);
- expect(linkedEditGroups[0].positions, hasLength(1));
- expect(linkedEditGroups[0].positions[0].offset, 4);
- // after the indent inside the block
- expect(linkedEditGroups[1].length, 0);
- expect(linkedEditGroups[1].positions, hasLength(1));
- expect(linkedEditGroups[1].positions[0].offset, 10);
- }
-
Future<void> test_writeFieldDeclaration_initializerWriter() async {
var path = convertPath('/home/test/lib/test.dart');
var content = 'class A {}';
diff --git a/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart b/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart
index 30bf295..e038554 100644
--- a/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart
+++ b/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart
@@ -606,19 +606,9 @@
final holderCode =
declareHolders(resourceName, nonStaticStateHolders(resource));
- // Set names if necessary on deferred holders list.
- js.Expression deferredHoldersList = js.ArrayInitializer(holderCode
- .activeHolders
- .map((holder) => js.js("#", holder.localName(resourceName)))
- .toList(growable: false));
- js.Statement setNames = js.js.statement(
- 'hunkHelpers.setFunctionNamesIfNecessary(#deferredHoldersList)',
- {'deferredHoldersList': deferredHoldersList});
-
// Update holder assignments.
List<js.Statement> updateHolderAssignments = [
if (holderCode.allHolders.isNotEmpty) holderCode.statement,
- setNames
];
for (var holder in holderCode.allHolders) {
var holderName = holder.localName(resourceName);
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index f470a14..adb19b0 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -73,24 +73,6 @@
// copying properties) on platforms where we know it works well (Chrome / d8).
var supportsDirectProtoAccess = #directAccessTestExpression;
-// Sets the name property of functions, if the JS engine doesn't set the name
-// itself.
-// As of 2018 only IE11 doesn't set the name.
-function setFunctionNamesIfNecessary(holders) {
- function t(){};
- if (typeof t.name == "string") return;
-
- for (var i = 0; i < holders.length; i++) {
- var holder = holders[i];
- var keys = Object.keys(holder);
- for (var j = 0; j < keys.length; j++) {
- var key = keys[j];
- var f = holder[key];
- if (typeof f == "function") f.name = key;
- }
- }
-}
-
// Makes [cls] inherit from [sup].
// On Chrome, Firefox and recent IEs this happens by updating the internal
// proto-property of the classes 'prototype' field.
@@ -420,7 +402,6 @@
lazyOld: lazyOld,
updateHolder: updateHolder,
convertToFastObject: convertToFastObject,
- setFunctionNamesIfNecessary: setFunctionNamesIfNecessary,
updateTypes: updateTypes,
setOrUpdateInterceptorsByTag: setOrUpdateInterceptorsByTag,
setOrUpdateLeafTags: setOrUpdateLeafTags,
@@ -444,9 +425,6 @@
// Creates the holders.
#holders;
-// If the name is not set on the functions, do it now.
-hunkHelpers.setFunctionNamesIfNecessary(holders);
-
// TODO(floitsch): we should build this object as a literal.
var #staticStateDeclaration = {};
diff --git a/pkg/dartdev/lib/src/commands/run.dart b/pkg/dartdev/lib/src/commands/run.dart
index 94b0141..39e5ea4 100644
--- a/pkg/dartdev/lib/src/commands/run.dart
+++ b/pkg/dartdev/lib/src/commands/run.dart
@@ -222,6 +222,8 @@
final bool debugDds = args['debug-dds'];
bool disableServiceAuthCodes = args['disable-service-auth-codes'];
+ final bool enableServicePortFallback =
+ args['enable-service-port-fallback'];
// If the user wants to start a debugging session we need to do some extra
// work and spawn a Dart Development Service (DDS) instance. DDS is a VM
@@ -237,6 +239,7 @@
disableServiceAuthCodes,
launchDevTools,
debugDds,
+ enableServicePortFallback,
)) {
return errorExitCode;
}
@@ -274,6 +277,7 @@
bool disableServiceAuthCodes,
bool enableDevTools,
bool debugDds,
+ bool enableServicePortFallback,
) async {
final sdkDir = dirname(sdk.dart);
final fullSdk = sdkDir.endsWith('bin');
@@ -303,6 +307,7 @@
enableDevTools.toString(),
devToolsBinaries,
debugDds.toString(),
+ enableServicePortFallback.toString(),
],
mode: ProcessStartMode.detachedWithStdio,
);
diff --git a/pkg/dartdev/test/commands/run_test.dart b/pkg/dartdev/test/commands/run_test.dart
index 40978d9..bf0f031 100644
--- a/pkg/dartdev/test/commands/run_test.dart
+++ b/pkg/dartdev/test/commands/run_test.dart
@@ -333,6 +333,25 @@
expect(result.exitCode, 0);
});
+ test('--enable-service-port-fallback', () async {
+ final p = project(mainSrc: '''void main() {}''');
+ final server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
+ final result = await p.run(
+ [
+ 'run',
+ '--enable-vm-service=${server.port}',
+ '--enable-service-port-fallback',
+ p.relativeFilePath,
+ ],
+ );
+ final regexp = RegExp(
+ r'Observatory listening on http:\/\/127.0.0.1:(\d*)\/[a-zA-Z0-9_-]+=\/\n.*');
+ final vmServicePort =
+ int.parse(regexp.firstMatch(result.stdout)!.group(1)!);
+ expect(server.port != vmServicePort, isTrue);
+ await server.close();
+ });
+
test('without verbose CFE info', () async {
final p = project(mainSrc: '''void main() {}''');
diff --git a/pkg/dds/bin/dds.dart b/pkg/dds/bin/dds.dart
index 2ae2f5a..7e43c19 100644
--- a/pkg/dds/bin/dds.dart
+++ b/pkg/dds/bin/dds.dart
@@ -18,6 +18,7 @@
/// - Start DevTools
/// - DevTools build directory
/// - Enable logging
+/// - Enable service port fallback
Future<void> main(List<String> args) async {
if (args.isEmpty) return;
@@ -46,6 +47,7 @@
devToolsBuildDirectory = Uri.file(args[5]);
}
final logRequests = args[6] == 'true';
+ final enableServicePortFallback = args[7] == 'true';
try {
// TODO(bkonyi): add retry logic similar to that in vmservice_server.dart
// See https://github.com/dart-lang/sdk/issues/43192.
@@ -61,6 +63,7 @@
)
: null,
logRequests: logRequests,
+ enableServicePortFallback: enableServicePortFallback,
);
stderr.write(json.encode({
'state': 'started',
diff --git a/pkg/dds/lib/dds.dart b/pkg/dds/lib/dds.dart
index 4d8a5e7..7d833ab 100644
--- a/pkg/dds/lib/dds.dart
+++ b/pkg/dds/lib/dds.dart
@@ -37,11 +37,15 @@
///
/// [ipv6] controls whether or not DDS is served via IPv6. IPv4 is enabled by
/// default.
+ ///
+ /// If [enablesServicePortFallback] is enabled, DDS will attempt to bind to any
+ /// available port if the specified port is unavailable.
static Future<DartDevelopmentService> startDartDevelopmentService(
Uri remoteVmServiceUri, {
Uri? serviceUri,
bool enableAuthCodes = true,
bool ipv6 = false,
+ bool enableServicePortFallback = false,
List<String> cachedUserTags = const [],
DevToolsConfiguration? devToolsConfiguration,
bool logRequests = false,
@@ -84,6 +88,7 @@
ipv6,
devToolsConfiguration,
logRequests,
+ enableServicePortFallback,
);
await service.startService();
return service;
diff --git a/pkg/dds/lib/src/dds_impl.dart b/pkg/dds/lib/src/dds_impl.dart
index 000a15b..8de53ff 100644
--- a/pkg/dds/lib/src/dds_impl.dart
+++ b/pkg/dds/lib/src/dds_impl.dart
@@ -59,6 +59,7 @@
this._ipv6,
this._devToolsConfiguration,
this.shouldLogRequests,
+ this._enableServicePortFallback,
) {
_clientManager = ClientManager(this);
_expressionEvaluator = ExpressionEvaluator(this);
@@ -136,7 +137,7 @@
final host = uri?.host ??
(_ipv6 ? InternetAddress.loopbackIPv6 : InternetAddress.loopbackIPv4)
.host;
- final port = uri?.port ?? 0;
+ var port = uri?.port ?? 0;
var pipeline = const Pipeline();
if (shouldLogRequests) {
pipeline = pipeline.addMiddleware(
@@ -155,16 +156,25 @@
late String errorMessage;
final tmpServer = await runZonedGuarded(
() async {
- try {
- return await io.serve(handler, host, port);
- } on SocketException catch (e) {
- errorMessage = e.message;
- if (e.osError != null) {
- errorMessage += ' (${e.osError!.message})';
+ Future<HttpServer?> startServer() async {
+ try {
+ return await io.serve(handler, host, port);
+ } on SocketException catch (e) {
+ if (_enableServicePortFallback && port != 0) {
+ // Try again, this time with a random port.
+ port = 0;
+ return await startServer();
+ }
+ errorMessage = e.message;
+ if (e.osError != null) {
+ errorMessage += ' (${e.osError!.message})';
+ }
+ errorMessage += ': ${e.address?.host}:${e.port}';
+ return null;
}
- errorMessage += ': ${e.address?.host}:${e.port}';
- return null;
}
+
+ return await startServer();
},
(error, stack) {
if (shouldLogRequests) {
@@ -387,6 +397,7 @@
String? get authCode => _authCode;
String? _authCode;
+ final bool _enableServicePortFallback;
final bool shouldLogRequests;
Uri get remoteVmServiceUri => _remoteVmServiceUri;
diff --git a/pkg/front_end/lib/src/fasta/kernel/macro/identifiers.dart b/pkg/front_end/lib/src/fasta/kernel/macro/identifiers.dart
index ad6743a..c742a83 100644
--- a/pkg/front_end/lib/src/fasta/kernel/macro/identifiers.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/macro/identifiers.dart
@@ -2,6 +2,7 @@
// 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 'package:_fe_analyzer_shared/src/macros/api.dart' as macro;
import 'package:_fe_analyzer_shared/src/macros/executor.dart' as macro;
import 'package:_fe_analyzer_shared/src/macros/executor/introspection_impls.dart'
as macro;
@@ -15,28 +16,24 @@
import '../../builder/type_alias_builder.dart';
import '../../builder/type_builder.dart';
import '../../builder/type_declaration_builder.dart';
+import 'macro.dart';
-abstract class IdentifierImpl implements macro.IdentifierImpl {
- macro.ResolvedIdentifier resolveIdentifier();
- DartType buildType(
- NullabilityBuilder nullabilityBuilder, List<DartType> typeArguments);
-}
-
-class TypeBuilderIdentifier extends macro.IdentifierImpl
- implements IdentifierImpl {
- final TypeBuilder typeBuilder;
- final LibraryBuilder libraryBuilder;
-
- TypeBuilderIdentifier({
- required this.typeBuilder,
- required this.libraryBuilder,
+abstract class IdentifierImpl extends macro.IdentifierImpl {
+ IdentifierImpl({
required int id,
required String name,
}) : super(id: id, name: name);
- @override
- macro.ResolvedIdentifier resolveIdentifier() {
- TypeDeclarationBuilder? typeDeclarationBuilder = typeBuilder.declaration;
+ macro.ResolvedIdentifier resolveIdentifier();
+
+ Future<macro.TypeDeclaration> resolveTypeDeclaration(
+ MacroApplications macroApplications);
+
+ DartType buildType(
+ NullabilityBuilder nullabilityBuilder, List<DartType> typeArguments);
+
+ macro.ResolvedIdentifier _resolveTypeDeclarationIdentifier(
+ TypeDeclarationBuilder? typeDeclarationBuilder) {
if (typeDeclarationBuilder != null) {
Uri? uri;
if (typeDeclarationBuilder is ClassBuilder) {
@@ -56,16 +53,53 @@
}
}
+ Future<macro.TypeDeclaration> _resolveTypeDeclaration(
+ MacroApplications macroApplications,
+ TypeDeclarationBuilder? typeDeclarationBuilder) {
+ if (typeDeclarationBuilder is ClassBuilder) {
+ return new Future.value(
+ macroApplications.getClassDeclaration(typeDeclarationBuilder));
+ } else if (typeDeclarationBuilder is TypeAliasBuilder) {
+ return new Future.value(
+ macroApplications.getTypeAliasDeclaration(typeDeclarationBuilder));
+ } else {
+ return new Future.error(
+ new ArgumentError('Unable to resolve identifier $this'));
+ }
+ }
+}
+
+class TypeBuilderIdentifier extends IdentifierImpl {
+ final TypeBuilder typeBuilder;
+ final LibraryBuilder libraryBuilder;
+
+ TypeBuilderIdentifier({
+ required this.typeBuilder,
+ required this.libraryBuilder,
+ required int id,
+ required String name,
+ }) : super(id: id, name: name);
+
+ @override
+ macro.ResolvedIdentifier resolveIdentifier() {
+ return _resolveTypeDeclarationIdentifier(typeBuilder.declaration);
+ }
+
@override
DartType buildType(
NullabilityBuilder nullabilityBuilder, List<DartType> typeArguments) {
return typeBuilder.declaration!.buildTypeWithBuiltArguments(libraryBuilder,
nullabilityBuilder.build(libraryBuilder), typeArguments);
}
+
+ @override
+ Future<macro.TypeDeclaration> resolveTypeDeclaration(
+ MacroApplications macroApplications) {
+ return _resolveTypeDeclaration(macroApplications, typeBuilder.declaration);
+ }
}
-class TypeDeclarationBuilderIdentifier extends macro.IdentifierImpl
- implements IdentifierImpl {
+class TypeDeclarationBuilderIdentifier extends IdentifierImpl {
final TypeDeclarationBuilder typeDeclarationBuilder;
final LibraryBuilder libraryBuilder;
@@ -78,19 +112,13 @@
@override
macro.ResolvedIdentifier resolveIdentifier() {
- Uri? uri;
- if (typeDeclarationBuilder is ClassBuilder) {
- uri = (typeDeclarationBuilder as ClassBuilder).library.importUri;
- } else if (typeDeclarationBuilder is TypeAliasBuilder) {
- uri = (typeDeclarationBuilder as TypeAliasBuilder).library.importUri;
- } else if (name == 'dynamic') {
- uri = Uri.parse('dart:core');
- }
- return new macro.ResolvedIdentifier(
- kind: macro.IdentifierKind.topLevelMember,
- name: name,
- staticScope: null,
- uri: uri);
+ return _resolveTypeDeclarationIdentifier(typeDeclarationBuilder);
+ }
+
+ @override
+ Future<macro.TypeDeclaration> resolveTypeDeclaration(
+ MacroApplications macroApplications) {
+ return _resolveTypeDeclaration(macroApplications, typeDeclarationBuilder);
}
@override
@@ -101,8 +129,7 @@
}
}
-class MemberBuilderIdentifier extends macro.IdentifierImpl
- implements IdentifierImpl {
+class MemberBuilderIdentifier extends IdentifierImpl {
final MemberBuilder memberBuilder;
MemberBuilderIdentifier(
@@ -134,10 +161,16 @@
NullabilityBuilder nullabilityBuilder, List<DartType> typeArguments) {
throw new UnsupportedError('Cannot build type from member.');
}
+
+ @override
+ Future<macro.TypeDeclaration> resolveTypeDeclaration(
+ MacroApplications macroApplications) {
+ return new Future.error(
+ new ArgumentError('Cannot resolve type declaration from member.'));
+ }
}
-class FormalParameterBuilderIdentifier extends macro.IdentifierImpl
- implements IdentifierImpl {
+class FormalParameterBuilderIdentifier extends IdentifierImpl {
final LibraryBuilder libraryBuilder;
final FormalParameterBuilder parameterBuilder;
@@ -162,4 +195,37 @@
NullabilityBuilder nullabilityBuilder, List<DartType> typeArguments) {
throw new UnsupportedError('Cannot build type from formal parameter.');
}
+
+ @override
+ Future<macro.TypeDeclaration> resolveTypeDeclaration(
+ MacroApplications macroApplications) {
+ throw new ArgumentError(
+ 'Cannot resolve type declaration from formal parameter.');
+ }
+}
+
+class OmittedTypeIdentifier extends IdentifierImpl {
+ OmittedTypeIdentifier({required int id}) : super(id: id, name: 'dynamic');
+
+ @override
+ DartType buildType(
+ NullabilityBuilder nullabilityBuilder, List<DartType> typeArguments) {
+ return const DynamicType();
+ }
+
+ @override
+ macro.ResolvedIdentifier resolveIdentifier() {
+ return new macro.ResolvedIdentifier(
+ kind: macro.IdentifierKind.topLevelMember,
+ name: name,
+ staticScope: null,
+ uri: Uri.parse('dart:core'));
+ }
+
+ @override
+ Future<macro.TypeDeclaration> resolveTypeDeclaration(
+ MacroApplications macroApplications) {
+ return new Future.error(new ArgumentError(
+ 'Cannot resolve type declaration from omitted type.'));
+ }
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/macro/macro.dart b/pkg/front_end/lib/src/fasta/kernel/macro/macro.dart
index 738e753..cdeeaaa3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/macro/macro.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/macro/macro.dart
@@ -20,6 +20,7 @@
import '../../builder/member_builder.dart';
import '../../builder/named_type_builder.dart';
import '../../builder/nullability_builder.dart';
+import '../../builder/type_alias_builder.dart';
import '../../builder/type_builder.dart';
import '../../builder/type_declaration_builder.dart';
import '../../identifiers.dart';
@@ -47,8 +48,8 @@
final Uri macroLibraryUri =
Uri.parse('package:_fe_analyzer_shared/src/macros/api.dart');
const String macroClassName = 'Macro';
-final macro.IdentifierImpl dynamicIdentifier = new macro.IdentifierImpl(
- id: macro.RemoteInstance.uniqueId, name: 'dynamic');
+final IdentifierImpl omittedTypeIdentifier =
+ new OmittedTypeIdentifier(id: macro.RemoteInstance.uniqueId);
class MacroDeclarationData {
bool macrosAreAvailable = false;
@@ -181,6 +182,7 @@
Map<ClassBuilder, macro.ClassDeclaration> _classDeclarations = {};
Map<macro.ClassDeclaration, ClassBuilder> _classBuilders = {};
+ Map<TypeAliasBuilder, macro.TypeAliasDeclaration> _typeAliasDeclarations = {};
Map<MemberBuilder, macro.Declaration?> _memberDeclarations = {};
// TODO(johnniwinther): Support all members.
@@ -189,10 +191,15 @@
_createMemberDeclaration(memberBuilder);
}
- macro.ClassDeclaration _getClassDeclaration(ClassBuilder builder) {
+ macro.ClassDeclaration getClassDeclaration(ClassBuilder builder) {
return _classDeclarations[builder] ??= _createClassDeclaration(builder);
}
+ macro.TypeAliasDeclaration getTypeAliasDeclaration(TypeAliasBuilder builder) {
+ return _typeAliasDeclarations[builder] ??=
+ _createTypeAliasDeclaration(builder);
+ }
+
ClassBuilder _getClassBuilder(macro.ClassDeclaration declaration) {
return _classBuilders[declaration]!;
}
@@ -217,20 +224,8 @@
if (identifier is IdentifierImpl) {
return identifier.resolveIdentifier();
} else {
- // TODO(johnniwinther): Use [_IdentifierImpl] for all identifiers.
- if (identical(identifier, dynamicIdentifier)) {
- return new macro.ResolvedIdentifier(
- kind: macro.IdentifierKind.topLevelMember,
- name: identifier.name,
- staticScope: null,
- uri: Uri.parse('dart:core'));
- } else {
- return new macro.ResolvedIdentifier(
- kind: macro.IdentifierKind.topLevelMember,
- name: identifier.name,
- staticScope: null,
- uri: null);
- }
+ throw new UnsupportedError(
+ 'Unsupported identifier ${identifier} (${identifier.runtimeType})');
}
}
@@ -259,7 +254,7 @@
classData.classApplications;
if (classApplications != null) {
macro.ClassDeclaration classDeclaration =
- _getClassDeclaration(classBuilder);
+ getClassDeclaration(classBuilder);
data.add(new _ApplicationData(libraryBuilder, classBuilder,
classDeclaration, classApplications));
}
@@ -436,7 +431,7 @@
late macro.TypeDeclarationResolver typeDeclarationResolver;
Future<List<SourceLibraryBuilder>> applyDefinitionMacros() async {
- typeDeclarationResolver = new _TypeDeclarationResolver();
+ typeDeclarationResolver = new _TypeDeclarationResolver(this);
List<SourceLibraryBuilder> augmentationLibraries = [];
Map<SourceLibraryBuilder, List<macro.MacroExecutionResult>> results = {};
for (_ApplicationData macroApplication in _applicationData) {
@@ -494,6 +489,21 @@
return declaration;
}
+ macro.TypeAliasDeclaration _createTypeAliasDeclaration(
+ TypeAliasBuilder builder) {
+ macro.TypeAliasDeclaration declaration = new macro.TypeAliasDeclarationImpl(
+ id: macro.RemoteInstance.uniqueId,
+ identifier: new TypeDeclarationBuilderIdentifier(
+ typeDeclarationBuilder: builder,
+ libraryBuilder: builder.library,
+ id: macro.RemoteInstance.uniqueId,
+ name: builder.name),
+ // TODO(johnniwinther): Support typeParameters
+ typeParameters: [],
+ aliasedType: _computeTypeAnnotation(builder.library, builder.type));
+ return declaration;
+ }
+
List<List<macro.ParameterDeclarationImpl>> _createParameters(
MemberBuilder builder, List<FormalParameterBuilder>? formals) {
List<macro.ParameterDeclarationImpl>? positionalParameters;
@@ -543,7 +553,7 @@
List<List<macro.ParameterDeclarationImpl>> parameters =
_createParameters(builder, formals);
macro.ClassDeclaration definingClass =
- _getClassDeclaration(builder.classBuilder as SourceClassBuilder);
+ getClassDeclaration(builder.classBuilder as SourceClassBuilder);
return new macro.ConstructorDeclarationImpl(
id: macro.RemoteInstance.uniqueId,
identifier: new MemberBuilderIdentifier(
@@ -571,7 +581,7 @@
List<List<macro.ParameterDeclarationImpl>> parameters =
_createParameters(builder, builder.formals);
macro.ClassDeclaration definingClass =
- _getClassDeclaration(builder.classBuilder as SourceClassBuilder);
+ getClassDeclaration(builder.classBuilder as SourceClassBuilder);
return new macro.ConstructorDeclarationImpl(
id: macro.RemoteInstance.uniqueId,
@@ -603,7 +613,7 @@
macro.ClassDeclaration? definingClass = null;
if (builder.classBuilder != null) {
definingClass =
- _getClassDeclaration(builder.classBuilder as SourceClassBuilder);
+ getClassDeclaration(builder.classBuilder as SourceClassBuilder);
}
if (definingClass != null) {
// TODO(johnniwinther): Should static fields be field or variable
@@ -653,7 +663,7 @@
macro.ClassDeclaration? definingClass = null;
if (builder.classBuilder != null) {
definingClass =
- _getClassDeclaration(builder.classBuilder as SourceClassBuilder);
+ getClassDeclaration(builder.classBuilder as SourceClassBuilder);
}
if (definingClass != null) {
// TODO(johnniwinther): Should static fields be field or variable
@@ -727,7 +737,7 @@
}
return new macro.NamedTypeAnnotationImpl(
id: macro.RemoteInstance.uniqueId,
- identifier: dynamicIdentifier,
+ identifier: omittedTypeIdentifier,
isNullable: false,
typeArguments: const []);
}
@@ -896,7 +906,7 @@
List<macro.ClassDeclaration> list = [];
for (ClassHierarchyNode interfaceNode in directInterfaceNodes) {
list.add(
- macroApplications._getClassDeclaration(interfaceNode.classBuilder));
+ macroApplications.getClassDeclaration(interfaceNode.classBuilder));
}
return new Future.value(list);
}
@@ -926,7 +936,7 @@
List<macro.ClassDeclaration>? list;
while (superNode != null && superNode.isMixinApplication) {
(list ??= []).add(macroApplications
- ._getClassDeclaration(superNode.mixedInNode!.classBuilder));
+ .getClassDeclaration(superNode.mixedInNode!.classBuilder));
superNode = superNode.directSuperClassNode;
}
return new Future.value(list?.reversed.toList() ?? const []);
@@ -944,17 +954,24 @@
}
if (superNode != null) {
return new Future.value(
- macroApplications._getClassDeclaration(superNode.classBuilder));
+ macroApplications.getClassDeclaration(superNode.classBuilder));
}
return new Future.value();
}
}
class _TypeDeclarationResolver implements macro.TypeDeclarationResolver {
+ final MacroApplications macroApplications;
+
+ _TypeDeclarationResolver(this.macroApplications);
+
@override
Future<macro.TypeDeclaration> declarationOf(macro.Identifier identifier) {
- // TODO: implement declarationOf
- throw new UnimplementedError('_TypeDeclarationResolver.declarationOf');
+ if (identifier is IdentifierImpl) {
+ return identifier.resolveTypeDeclaration(macroApplications);
+ }
+ throw new UnsupportedError(
+ 'Unsupported identifier $identifier (${identifier.runtimeType})');
}
}
diff --git a/runtime/bin/main_options.cc b/runtime/bin/main_options.cc
index 83c1408..7cb1c3f 100644
--- a/runtime/bin/main_options.cc
+++ b/runtime/bin/main_options.cc
@@ -666,6 +666,10 @@
if (implicitly_use_dart_dev && Options::vm_service_auth_disabled()) {
dart_options->AddArgument("--disable-service-auth-codes");
}
+ if (implicitly_use_dart_dev &&
+ Options::enable_service_port_fallback()) {
+ dart_options->AddArgument("--enable-service-port-fallback");
+ }
}
first_option = false;
}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index a9e0d13..098371e 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -255,12 +255,14 @@
dart/appjit*: SkipSlow # DFE too slow
dart/b162922506_test: SkipSlow # Generates large input file
dart/data_uri_spawn_test: Skip # Please triage.
+dart/isolates/fast_object_copy_test*: Slow # issue 46740
dart/minimal_kernel_test: SkipSlow # gen_kernel is too slow on simulated architectures
dart/null_safety_autodetection_in_kernel_compiler_test: SkipSlow # gen_kernel is too slow on simulated architectures
dart/snapshot_version_test: RuntimeError # Please triage.
dart_2/appjit*: SkipSlow # DFE too slow
dart_2/b162922506_test: SkipSlow # Generates large input file
dart_2/data_uri_spawn_test: Skip # Please triage.
+dart_2/isolates/fast_object_copy_test*: Slow # issue 46740
dart_2/minimal_kernel_test: SkipSlow # gen_kernel is too slow on simulated architectures
dart_2/null_safety_autodetection_in_kernel_compiler_test: SkipSlow # gen_kernel is too slow on simulated architectures
dart_2/snapshot_version_test: RuntimeError # Please triage.
diff --git a/runtime/vm/compiler/stub_code_compiler_ia32.cc b/runtime/vm/compiler/stub_code_compiler_ia32.cc
index 352036d..569c246 100644
--- a/runtime/vm/compiler/stub_code_compiler_ia32.cc
+++ b/runtime/vm/compiler/stub_code_compiler_ia32.cc
@@ -969,12 +969,10 @@
// ESP + 16 : current thread.
// Uses EAX, EDX, ECX, EDI as temporary registers.
void StubCodeCompiler::GenerateInvokeDartCodeStub(Assembler* assembler) {
- const intptr_t kTargetCodeOffset = 3 * target::kWordSize;
- const intptr_t kArgumentsDescOffset = 4 * target::kWordSize;
- const intptr_t kArgumentsOffset = 5 * target::kWordSize;
- const intptr_t kThreadOffset = 6 * target::kWordSize;
-
- NOT_IN_PRODUCT(__ pushl(Address(ESP, 0))); // Marker for the profiler.
+ const intptr_t kTargetCodeOffset = 2 * target::kWordSize;
+ const intptr_t kArgumentsDescOffset = 3 * target::kWordSize;
+ const intptr_t kArgumentsOffset = 4 * target::kWordSize;
+ const intptr_t kThreadOffset = 5 * target::kWordSize;
__ EnterFrame(0);
// Push code object to PC marker slot.
@@ -1089,7 +1087,6 @@
// Restore the frame pointer.
__ LeaveFrame();
- NOT_IN_PRODUCT(__ popl(ECX)); // Drop profiler marker.
__ ret();
}
diff --git a/runtime/vm/compiler/stub_code_compiler_x64.cc b/runtime/vm/compiler/stub_code_compiler_x64.cc
index 7ae8fbc..308de1d 100644
--- a/runtime/vm/compiler/stub_code_compiler_x64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_x64.cc
@@ -1377,7 +1377,6 @@
// RDX : arguments array.
// RCX : current thread.
void StubCodeCompiler::GenerateInvokeDartCodeStub(Assembler* assembler) {
- NOT_IN_PRODUCT(__ pushq(Address(RSP, 0))); // Marker for the profiler.
__ EnterFrame(0);
const Register kTargetReg = CallingConventions::kArg1Reg;
@@ -1520,7 +1519,6 @@
// Restore the frame pointer.
__ LeaveFrame();
- NOT_IN_PRODUCT(__ popq(RCX)); // Drop profiler marker.
__ ret();
}
diff --git a/runtime/vm/constants_riscv.h b/runtime/vm/constants_riscv.h
index 4979017..df9658f 100644
--- a/runtime/vm/constants_riscv.h
+++ b/runtime/vm/constants_riscv.h
@@ -1419,6 +1419,11 @@
#undef R
+inline Register ConcreteRegister(Register r) {
+ return r;
+}
+#define LINK_REGISTER RA
+
} // namespace dart
#endif // RUNTIME_VM_CONSTANTS_RISCV_H_
diff --git a/runtime/vm/elf.cc b/runtime/vm/elf.cc
index 7f87db9..004c18c 100644
--- a/runtime/vm/elf.cc
+++ b/runtime/vm/elf.cc
@@ -1361,7 +1361,17 @@
}
void Elf::FinalizeEhFrame() {
-#if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64)
+#if !defined(TARGET_ARCH_IA32)
+#if defined(TARGET_ARCH_X64)
+ // The x86_64 psABI defines the DWARF register numbers, which differ from
+ // the registers' usual encoding within instructions.
+ const intptr_t DWARF_RA = 16; // No corresponding register.
+ const intptr_t DWARF_FP = 6; // RBP
+#else
+ const intptr_t DWARF_RA = ConcreteRegister(LINK_REGISTER);
+ const intptr_t DWARF_FP = FP;
+#endif
+
// No text section added means no .eh_frame.
TextSection* text_section = nullptr;
if (auto* const section = section_table_->Find(kTextName)) {
@@ -1391,18 +1401,17 @@
dwarf_stream.string("zR"); // NOLINT
dwarf_stream.uleb128(1); // Code alignment (must be 1).
dwarf_stream.sleb128(kDataAlignment); // Data alignment
- dwarf_stream.u1(
- ConcreteRegister(LINK_REGISTER)); // Return address register
+ dwarf_stream.u1(DWARF_RA); // Return address register
dwarf_stream.uleb128(1); // Augmentation size
dwarf_stream.u1(DW_EH_PE_pcrel | DW_EH_PE_sdata4); // FDE encoding.
// CFA is caller's SP (FP+kCallerSpSlotFromFp*kWordSize)
dwarf_stream.u1(Dwarf::DW_CFA_def_cfa);
- dwarf_stream.uleb128(FP);
+ dwarf_stream.uleb128(DWARF_FP);
dwarf_stream.uleb128(kCallerSpSlotFromFp * compiler::target::kWordSize);
});
// Emit rule defining that |reg| value is stored at CFA+offset.
- const auto cfa_offset = [&](Register reg, intptr_t offset) {
+ const auto cfa_offset = [&](intptr_t reg, intptr_t offset) {
const intptr_t scaled_offset = offset / kDataAlignment;
RELEASE_ASSERT(scaled_offset >= 0);
dwarf_stream.u1(Dwarf::DW_CFA_offset | reg);
@@ -1424,13 +1433,13 @@
// Caller FP at FP+kSavedCallerPcSlotFromFp*kWordSize,
// where FP is CFA - kCallerSpSlotFromFp*kWordSize.
COMPILE_ASSERT((kSavedCallerFpSlotFromFp - kCallerSpSlotFromFp) <= 0);
- cfa_offset(FP,
+ cfa_offset(DWARF_FP,
(kSavedCallerFpSlotFromFp - kCallerSpSlotFromFp) * kWordSize);
// Caller LR at FP+kSavedCallerPcSlotFromFp*kWordSize,
// where FP is CFA - kCallerSpSlotFromFp*kWordSize
COMPILE_ASSERT((kSavedCallerPcSlotFromFp - kCallerSpSlotFromFp) <= 0);
- cfa_offset(ConcreteRegister(LINK_REGISTER),
+ cfa_offset(DWARF_RA,
(kSavedCallerPcSlotFromFp - kCallerSpSlotFromFp) * kWordSize);
});
}
@@ -1442,7 +1451,7 @@
eh_frame->AddPortion(dwarf_stream.buffer(), dwarf_stream.bytes_written(),
dwarf_stream.relocations());
section_table_->Add(eh_frame, ".eh_frame");
-#endif // defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64)
+#endif // !defined(TARGET_ARCH_IA32)
}
void Elf::FinalizeDwarfSections() {
diff --git a/runtime/vm/image_snapshot.cc b/runtime/vm/image_snapshot.cc
index 4528f28..f1113d3 100644
--- a/runtime/vm/image_snapshot.cc
+++ b/runtime/vm/image_snapshot.cc
@@ -1298,7 +1298,9 @@
// tells unwinder that caller's value of register R is stored at address
// CFA+offs.
-#if defined(TARGET_ARCH_X64)
+#if defined(TARGET_ARCH_IA32)
+ UNREACHABLE();
+#elif defined(TARGET_ARCH_X64)
assembly_stream_->WriteString(".cfi_def_cfa rbp, 16\n");
assembly_stream_->WriteString(".cfi_offset rbp, -16\n");
assembly_stream_->WriteString(".cfi_offset rip, -8\n");
@@ -1319,7 +1321,6 @@
assembly_stream_->WriteString(".cfi_offset r11, -8\n");
#endif
assembly_stream_->WriteString(".cfi_offset lr, -4\n");
-
// libunwind on ARM may use .ARM.exidx instead of .debug_frame
#if !defined(DART_TARGET_OS_MACOS) && !defined(DART_TARGET_OS_MACOS_IOS)
COMPILE_ASSERT(FP == R11);
@@ -1327,6 +1328,16 @@
assembly_stream_->WriteString(".save {r11, lr}\n");
assembly_stream_->WriteString(".setfp r11, sp, #0\n");
#endif
+#elif defined(TARGET_ARCH_RISCV32)
+ assembly_stream_->WriteString(".cfi_def_cfa fp, 0\n");
+ assembly_stream_->WriteString(".cfi_offset fp, -8\n");
+ assembly_stream_->WriteString(".cfi_offset ra, -4\n");
+#elif defined(TARGET_ARCH_RISCV64)
+ assembly_stream_->WriteString(".cfi_def_cfa fp, 0\n");
+ assembly_stream_->WriteString(".cfi_offset fp, -16\n");
+ assembly_stream_->WriteString(".cfi_offset ra, -8\n");
+#else
+#error Unexpected architecture.
#endif
}
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index c5c5e3b..b0261f0 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -1028,6 +1028,7 @@
SampleBuffer* sample_buffer,
uword pc,
uword fp,
+ uword sp,
uword lr,
bool allocation_sample,
intptr_t skip_count = 0)
@@ -1040,6 +1041,7 @@
thread_(thread),
pc_(reinterpret_cast<uword*>(pc)),
fp_(reinterpret_cast<uword*>(fp)),
+ sp_(reinterpret_cast<uword*>(sp)),
lr_(reinterpret_cast<uword*>(lr)) {}
void walk() {
@@ -1068,28 +1070,28 @@
// No Dart on the stack; caller shouldn't use this walker.
UNREACHABLE();
}
+
+ const bool is_entry_frame =
+#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
+ StubCode::InInvocationStub(Stack(0)) ||
+ StubCode::InInvocationStub(Stack(1));
+#else
+ StubCode::InInvocationStub(reinterpret_cast<uword>(lr_));
+#endif
+ if (is_entry_frame) {
+ // During the prologue of a function, CallerPC will return the caller's
+ // caller. For most frames, the missing PC will be added during profile
+ // processing. However, during this stack walk, it can cause us to fail
+ // to identify the entry frame and lead the stack walk into the weeds.
+ // Do not continue the stalk walk since this might be a false positive
+ // from a Smi or unboxed value.
+ sample_->set_ignore_sample(true);
+ return;
+ }
}
sample_->set_exit_frame_sample(has_exit_frame);
-#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
- const bool is_entry_frame = (CallerPC() == EntryMarker());
-#else
- const bool is_entry_frame =
- (StubCode::InInvocationStub(reinterpret_cast<uword>(lr_)));
-#endif
- if (!has_exit_frame && is_entry_frame) {
- // During the prologue of a function, CallerPC will return the caller's
- // caller. For most frames, the missing PC will be added during profile
- // processing. However, during this stack walk, it can cause us to fail
- // to identify the entry frame and lead the stack walk into the weeds.
- // Do not continue the stalk walk since this might be a false positive
- // from a Smi or unboxed value.
- RELEASE_ASSERT(!has_exit_frame);
- sample_->set_ignore_sample(true);
- return;
- }
-
for (;;) {
// Skip entry frame.
if (StubCode::InInvocationStub(reinterpret_cast<uword>(pc_))) {
@@ -1145,20 +1147,19 @@
return reinterpret_cast<uword*>(*exit_link_ptr);
}
- // Note because of stack guards, it is important that this marker lives
- // above FP.
- uword* EntryMarker() const {
- ASSERT(fp_ != NULL);
- uword* entry_marker_ptr = fp_ + kSavedCallerPcSlotFromFp + 1;
+ uword Stack(intptr_t index) const {
+ ASSERT(sp_ != NULL);
+ uword* stack_ptr = sp_ + index;
// MSan/ASan are unaware of frames initialized by generated code.
- MSAN_UNPOISON(entry_marker_ptr, kWordSize);
- ASAN_UNPOISON(entry_marker_ptr, kWordSize);
- return reinterpret_cast<uword*>(*entry_marker_ptr);
+ MSAN_UNPOISON(stack_ptr, kWordSize);
+ ASAN_UNPOISON(stack_ptr, kWordSize);
+ return *stack_ptr;
}
Thread* const thread_;
uword* pc_;
uword* fp_;
+ uword* sp_;
uword* lr_;
};
@@ -1367,8 +1368,8 @@
native_stack_walker.walk();
} else if (exited_dart_code) {
ProfilerDartStackWalker dart_exit_stack_walker(
- thread, sample, isolate->current_allocation_sample_block(), pc, fp, lr,
- /* allocation_sample*/ true);
+ thread, sample, isolate->current_allocation_sample_block(), pc, fp, sp,
+ lr, /* allocation_sample*/ true);
dart_exit_stack_walker.walk();
} else {
// Fall back.
@@ -1562,7 +1563,7 @@
sp);
const bool exited_dart_code = thread->HasExitedDartCode();
ProfilerDartStackWalker dart_stack_walker(
- thread, sample, isolate->current_sample_block(), pc, fp, lr,
+ thread, sample, isolate->current_sample_block(), pc, fp, sp, lr,
/* allocation_sample*/ false);
// All memory access is done inside CollectSample.
diff --git a/sdk/lib/_internal/vm/bin/vmservice_io.dart b/sdk/lib/_internal/vm/bin/vmservice_io.dart
index 3df0e4c..033a9cf 100644
--- a/sdk/lib/_internal/vm/bin/vmservice_io.dart
+++ b/sdk/lib/_internal/vm/bin/vmservice_io.dart
@@ -103,6 +103,7 @@
enableDevTools.toString(),
devToolsBinaries,
enableLogging.toString(),
+ _enableServicePortFallback.toString(),
],
mode: ProcessStartMode.detachedWithStdio,
);
diff --git a/sdk/lib/_internal/vm/bin/vmservice_server.dart b/sdk/lib/_internal/vm/bin/vmservice_server.dart
index c8e61b2..1c06579 100644
--- a/sdk/lib/_internal/vm/bin/vmservice_server.dart
+++ b/sdk/lib/_internal/vm/bin/vmservice_server.dart
@@ -409,11 +409,8 @@
// Already running.
return this;
}
-
// Startup HTTP server.
- var pollError;
- var pollStack;
- Future<bool> poll() async {
+ Future<bool> startServer() async {
try {
var address;
var addresses = await InternetAddress.lookup(_ip);
@@ -423,32 +420,25 @@
if (address.type == InternetAddressType.IPv4) break;
}
_server = await HttpServer.bind(address, _port);
- return true;
} catch (e, st) {
- pollError = e;
- pollStack = st;
- return false;
+ if (_port != 0 && _enableServicePortFallback) {
+ serverPrint('Failed to bind Observatory HTTP server to port $_port. '
+ 'Falling back to automatic port selection');
+ _port = 0;
+ return await startServer();
+ } else {
+ serverPrint('Could not start Observatory HTTP server:\n'
+ '$e\n$st');
+ _notifyServerState('');
+ onServerAddressChange(null);
+ return false;
+ }
}
+ return true;
}
- // poll for the network for ~10 seconds.
- int attempts = 0;
- final maxAttempts = 10;
- while (!await poll()) {
- attempts++;
- serverPrint('Observatory server failed to start after $attempts tries');
- if (attempts > maxAttempts) {
- serverPrint('Could not start Observatory HTTP server:\n'
- '$pollError\n$pollStack\n');
- _notifyServerState('');
- onServerAddressChange(null);
- return this;
- }
- if (_port != 0 && _enableServicePortFallback && attempts >= 3) {
- _port = 0;
- serverPrint('Falling back to automatic port selection');
- }
- await Future<void>.delayed(const Duration(seconds: 1));
+ if (!(await startServer())) {
+ return this;
}
if (_service.isExiting) {
serverPrint('Observatory HTTP server exiting before listening as '
diff --git a/tools/VERSION b/tools/VERSION
index 4471376..d2dbbe7 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 209
+PRERELEASE 210
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/bot_utils.py b/tools/bots/bot_utils.py
index a010a6f..98b48eb 100755
--- a/tools/bots/bot_utils.py
+++ b/tools/bots/bot_utils.py
@@ -40,6 +40,7 @@
}
SYSTEM_TO_CIPD = {
+ 'win32': 'windows',
'windows': 'windows',
'linux': 'linux',
'macos': 'mac',
diff --git a/tools/bots/dart_sdk.py b/tools/bots/dart_sdk.py
index 7f6bfb4..87ab3b6 100755
--- a/tools/bots/dart_sdk.py
+++ b/tools/bots/dart_sdk.py
@@ -250,7 +250,11 @@
CreateAndUploadSDKZip(arch, sdk_path)
DartArchiveUnstrippedBinaries(arch)
if CHANNEL != bot_utils.Channel.BLEEDING_EDGE:
- UploadFlutterCipd(arch, sdk_path, CHANNEL)
+ try:
+ UploadFlutterCipd(arch, sdk_path, CHANNEL)
+ except Exception as error:
+ print('Error uploading to CIPD:')
+ print(repr(error))
if BUILD_OS == 'linux':
CreateUploadVersionFile()
else:
diff --git a/tools/dom/OWNERS b/tools/dom/OWNERS
new file mode 100644
index 0000000..f5bd90c
--- /dev/null
+++ b/tools/dom/OWNERS
@@ -0,0 +1 @@
+file:/tools/OWNERS_WEB