Fix warnings after migration of the migration tool.

Change-Id: Ia1c1f71809ce8d843ee2ed7d99e530ace83e18ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204482
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Paul Berry 2021-06-23 23:35:47 +00:00
parent 6594ded7d9
commit 768104377b
9 changed files with 3145 additions and 3142 deletions

View file

@ -759,7 +759,7 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
DecoratedType? visitConstructorDeclaration(ConstructorDeclaration node) {
_fieldsNotInitializedByConstructor =
_fieldsNotInitializedAtDeclaration!.toSet();
_dispatch(node.redirectedConstructor?.type?.typeArguments);
_dispatch(node.redirectedConstructor?.type.typeArguments);
_handleExecutableDeclaration(
node,
node.declaredElement!,
@ -2514,7 +2514,7 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
var calleeType = _variables!.decoratedElementType(callee);
var typeArguments = redirectedConstructor.type.typeArguments;
var typeArgumentTypes =
typeArguments?.arguments?.map((t) => t.type)?.toList();
typeArguments?.arguments.map((t) => t.type).toList();
_handleInvocationArguments(
redirectedConstructor,
parameters.parameters,
@ -2804,7 +2804,7 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
var variableElement = parts.loopVariable.declaredElement!;
_flowAnalysis!.declare(variableElement, true);
lhsElement = variableElement;
_dispatch(parts.loopVariable?.type);
_dispatch(parts.loopVariable.type);
lhsType = _variables!.decoratedElementType(lhsElement);
} else if (parts is ForEachPartsWithIdentifier) {
lhsElement = parts.identifier.staticElement;
@ -2842,7 +2842,7 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
if (parts is ForParts) {
_flowAnalysis!.for_updaterBegin();
for (var updater in parts.updaters ?? <Expression>[]) {
for (var updater in parts.updaters) {
var updaterType = _dispatch(updater)!;
_graph.connectDummy(updaterType.node, DummyOrigin(source, updater));
}
@ -3094,7 +3094,7 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
/// [`checkNotNull`]: https://pub.dev/documentation/quiver/latest/quiver.check/checkNotNull.html
void _handleQuiverCheckNotNull(MethodInvocation node) {
var callee = node.methodName.staticElement;
var calleeUri = callee?.library?.source?.uri;
var calleeUri = callee?.library?.source.uri;
var isQuiverCheckNull = callee?.name == 'checkNotNull' &&
calleeUri != null &&
calleeUri.scheme == 'package' &&
@ -3144,7 +3144,7 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
if (grandParent is MethodInvocation) {
var enclosingInvocation = grandParent.methodName;
if (enclosingInvocation.name == 'setUp') {
var uri = enclosingInvocation.staticElement!.library?.source?.uri;
var uri = enclosingInvocation.staticElement!.library?.source.uri;
if (uri != null &&
uri.scheme == 'package' &&
uri.path.startsWith('test_core/')) {

View file

@ -1242,7 +1242,7 @@ class _FixBuilderPreVisitor extends GeneralizingAstVisitor<void>
..addRequiredKeyword = true
..addRequiredKeywordInfo = info
..requiredHint = requiredHint;
var requiredAnnotation = metadata?.firstWhereOrNull(
var requiredAnnotation = metadata.firstWhereOrNull(
(annotation) => annotation.elementAnnotation!.isRequired);
if (requiredAnnotation != null) {
// If the parameter was annotated with `@required`, but it was not the

File diff suppressed because it is too large Load diff

View file

@ -193,7 +193,7 @@ class UnitRenderer {
var lineNumber = 1;
void finishRow(bool isAddedText) {
var line = currentTextCell?.toString();
var line = currentTextCell.toString();
if (isAddedLine) {
rows.add('<tr><td class="line-no">(new)</td><td>$line</td></tr>');
} else {

View file

@ -167,7 +167,7 @@ class TraceEntry {
hintActions = (json['hintActions'] as List?)
?.map((value) =>
HintAction.fromJson(value as Map<String, Object?>))
?.toList() ??
.toList() ??
const [];
Map<String, Object?> toJson() => {

View file

@ -770,6 +770,9 @@ void toggleFileMigrationStatus(NavigationTreeFileNode entity) {
case UnitMigrationStatus.indeterminate:
throw StateError('File ${entity.path} should not have '
'indeterminate migration status');
default:
// TODO(paulberry): this should never happen.
break;
}
}

View file

@ -80,9 +80,9 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
@override
DecoratedType? visitAsExpression(AsExpression node) {
node.expression?.accept(this);
node.expression.accept(this);
_pushNullabilityNodeTarget(
NullabilityNodeTarget.text('cast type'), () => node.type?.accept(this));
NullabilityNodeTarget.text('cast type'), () => node.type.accept(this));
return null;
}
@ -119,7 +119,7 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
source, node.stackTraceParameter, stackTraceType);
}
node.stackTraceParameter?.accept(this);
node.body?.accept(this);
node.body.accept(this);
return null;
}
@ -203,7 +203,7 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
@override
DecoratedType? visitConstructorName(ConstructorName node) {
_pushNullabilityNodeTarget(NullabilityNodeTarget.text('constructed type'),
() => node.type?.accept(this));
() => node.type.accept(this));
node.name?.accept(this);
return null;
}
@ -357,10 +357,10 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
@override
DecoratedType? visitFunctionExpressionInvocation(
FunctionExpressionInvocation node) {
node.function?.accept(this);
node.function.accept(this);
_pushNullabilityNodeTarget(NullabilityNodeTarget.text('type argument'),
() => node.typeArguments?.accept(this));
node.argumentList?.accept(this);
node.argumentList.accept(this);
return null;
}
@ -391,7 +391,7 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
DecoratedType decoratedFunctionType;
try {
node.typeParameters?.accept(this);
_pushNullabilityNodeTarget(target, () => node.parameters?.accept(this));
_pushNullabilityNodeTarget(target, () => node.parameters.accept(this));
// Note: we don't pass _typeFormalBounds into DecoratedType because we're
// not defining a generic function type, we're defining a generic typedef
// of an ordinary (non-generic) function type.
@ -433,9 +433,9 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
@override
DecoratedType? visitIsExpression(IsExpression node) {
node.expression?.accept(this);
node.expression.accept(this);
_pushNullabilityNodeTarget(NullabilityNodeTarget.text('tested type'),
() => node.type?.accept(this));
() => node.type.accept(this));
return null;
}
@ -465,17 +465,17 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
@override
DecoratedType? visitMethodInvocation(MethodInvocation node) {
node.target?.accept(this);
node.methodName?.accept(this);
node.methodName.accept(this);
_pushNullabilityNodeTarget(NullabilityNodeTarget.text('type argument'),
() => node.typeArguments?.accept(this));
node.argumentList?.accept(this);
node.argumentList.accept(this);
return null;
}
@override
DecoratedType? visitMixinDeclaration(MixinDeclaration node) {
node.metadata.accept(this);
node.name?.accept(this);
node.name.accept(this);
node.typeParameters?.accept(this);
node.members.accept(this);
_handleSupertypeClauses(node, node.declaredElement!, null, null,
@ -723,7 +723,7 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
returnType: decoratedReturnType,
positionalParameters: _positionalParameters,
namedParameters: _namedParameters);
body?.accept(this);
body.accept(this);
} finally {
_positionalParameters = previousPositionalParameters;
_namedParameters = previousNamedParameters;
@ -738,7 +738,7 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
TypeParameterList? typeParameters,
FormalParameterList? parameters) {
var declaredElement = node.declaredElement!;
node.metadata?.accept(this);
node.metadata.accept(this);
DecoratedType? decoratedType;
var target = safeTarget;
if (parameters == null) {

View file

@ -379,14 +379,14 @@ class NullabilityGraph {
NullabilityNode destinationNode,
_NullabilityEdgeKind kind,
EdgeOrigin origin) {
var isUninit = origin?.kind == EdgeOriginKind.fieldNotInitialized ||
origin?.kind == EdgeOriginKind.implicitNullInitializer ||
origin?.kind == EdgeOriginKind.uninitializedRead;
var isUninit = origin.kind == EdgeOriginKind.fieldNotInitialized ||
origin.kind == EdgeOriginKind.implicitNullInitializer ||
origin.kind == EdgeOriginKind.uninitializedRead;
var isSetupAssignment =
origin is ExpressionChecksOrigin && origin.isSetupAssignment;
var edge = NullabilityEdge._(
destinationNode, upstreamNodes, kind, origin.description,
codeReference: origin?.codeReference,
codeReference: origin.codeReference,
isUninit: isUninit,
isSetupAssignment: isSetupAssignment);
instrumentation?.graphEdge(edge, origin);

View file

@ -62,7 +62,7 @@ class HttpPreviewServer {
/// Return the port this server is bound to.
Future<String?> get boundHostname async {
return (await _serverFuture)?.address?.host;
return (await _serverFuture)?.address.host;
}
/// Return the port this server is bound to.