Skip to content

Commit

Permalink
Version 2.17.0-94.0.dev
Browse files Browse the repository at this point in the history
Merge commit '4fb3d2afcf424ff3f73d55fc1585c448cdaa8762' into 'dev'
  • Loading branch information
Dart CI committed Feb 10, 2022
2 parents 7e3310b + 4fb3d2a commit a9cfcc2
Show file tree
Hide file tree
Showing 245 changed files with 2,523 additions and 2,977 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ vars = {
"fixnum_rev": "848341f061359ef7ddc0cad472c2ecbb036b28ac",
"file_rev": "0e09370f581ab6388d46fda4cdab66638c0171a1",
"glob_rev": "da1f4595ee2f87982cbcc663d4cac244822d9227",
"html_rev": "00cd3c22dac0e68e6ed9e7e4945101aedb1b3109",
"html_rev": "3c2448108b431dd00d3a7033d9f43f19fa5d93d3",
"http_io_rev": "2fa188caf7937e313026557713f7feffedd4978b",
"http_multi_server_rev": "34bf7f04b61cce561f47f7f275c2cc811534a05a",
"http_parser_rev": "202391286ddc13c4c3c284ac5b511f04697250ed",
Expand Down
3 changes: 2 additions & 1 deletion pkg/analysis_server/lib/src/protocol_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ SearchResultKind newSearchResultKind_fromEngine(engine.MatchKind kind) {
if (kind == engine.MatchKind.WRITE) {
return SearchResultKind.WRITE;
}
if (kind == engine.MatchKind.INVOCATION) {
if (kind == engine.MatchKind.INVOCATION ||
kind == engine.MatchKind.INVOCATION_BY_ENUM_CONSTANT_WITHOUT_ARGUMENTS) {
return SearchResultKind.INVOCATION;
}
if (kind == engine.MatchKind.REFERENCE ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class MakeVariableNullable extends CorrectionProducer {
await _forFunctionTypedFormalParameter(builder, node, parent);
} else if (node is SimpleIdentifier && parent is FieldFormalParameter) {
await _forFieldFormalParameter(builder, node, parent);
} else if (node is SimpleIdentifier && parent is SuperFormalParameter) {
await _forSuperFormalParameter(builder, node, parent);
} else if (node is Expression &&
parent is AssignmentExpression &&
parent.rightHandSide == node) {
Expand Down Expand Up @@ -164,6 +166,31 @@ class MakeVariableNullable extends CorrectionProducer {
});
}

/// Makes [parameter] nullable if possible.
Future<void> _forSuperFormalParameter(ChangeBuilder builder,
SimpleIdentifier name, SuperFormalParameter parameter) async {
if (parameter.parameters != null) {
// A function-typed field formal parameter.
if (parameter.question != null) {
return;
}
_variableName = parameter.identifier.name;
await builder.addDartFileEdit(file, (builder) {
// Add '?' after `)`.
builder.addSimpleInsertion(parameter.endToken.end, '?');
});
} else {
var type = parameter.type;
if (type == null || !_typeCanBeMadeNullable(type)) {
return;
}
_variableName = parameter.identifier.name;
await builder.addDartFileEdit(file, (builder) {
builder.addSimpleInsertion(type.end, '?');
});
}
}

Future<void> _forVariableDeclaration(ChangeBuilder builder, Expression node,
VariableDeclaration parent) async {
var declarationList = parent.parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ CompileTimeErrorCode.SPREAD_EXPRESSION_FROM_DEFERRED_LIBRARY: needs evaluation
CompileTimeErrorCode.STATIC_ACCESS_TO_INSTANCE_MEMBER: needs evaluation
CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_TYPE_IS_NOT_SUBTYPE_OF_ASSOCIATED: needs fix; new in 2.17
CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_NAMED: needs evaluation; new in 2.17
CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_POSITIONAL: needs fix; new in 2.17
CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_POSITIONAL: needs fix; https://github.com/dart-lang/sdk/issues/48359
CompileTimeErrorCode.SUPER_IN_EXTENSION: needs evaluation
CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT: needs evaluation
CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR: needs evaluation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class MatchKind {
/// A reference to an element in which it is being invoked.
static const MatchKind INVOCATION = MatchKind('INVOCATION');

/// An invocation of an enum constructor from an enum constant without
/// arguments.
static const MatchKind INVOCATION_BY_ENUM_CONSTANT_WITHOUT_ARGUMENTS =
MatchKind('INVOCATION_BY_ENUM_CONSTANT_WITHOUT_ARGUMENTS');

/// A reference to an element in which it is referenced.
static const MatchKind REFERENCE = MatchKind('REFERENCE');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ class SearchMatchImpl implements SearchMatch {
if (kind == SearchResultKind.INVOCATION) {
return MatchKind.INVOCATION;
}
if (kind ==
SearchResultKind.INVOCATION_BY_ENUM_CONSTANT_WITHOUT_ARGUMENTS) {
return MatchKind.INVOCATION_BY_ENUM_CONSTANT_WITHOUT_ARGUMENTS;
}
if (kind == SearchResultKind.REFERENCE_BY_CONSTRUCTOR_TEAR_OFF) {
return MatchKind.REFERENCE_BY_CONSTRUCTOR_TEAR_OFF;
}
Expand Down
Loading

0 comments on commit a9cfcc2

Please sign in to comment.