mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:30:17 +00:00
Remove unnecessary null check on initializerType
.
Now that the front end has been fully migrated to null safety, there are no longer any code paths that can result in a `null` value being stored in `ExpressionInferenceResult.inferredType`, so we can safely remove this check. Change-Id: I742bc81f8c017c6c91b80ddfd608a21613916370 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306913 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
parent
26fd946904
commit
d4c2d65907
|
@ -8709,16 +8709,11 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
initialized: node.hasDeclaredInitializer);
|
||||
if (initializerResult != null) {
|
||||
DartType initializerType = initializerResult.inferredType;
|
||||
// TODO(paulberry): `initializerType` is sometimes `null` during top
|
||||
// level inference. Figure out how to prevent this.
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (initializerType != null) {
|
||||
flowAnalysis.initialize(
|
||||
node, initializerType, initializerResult.expression,
|
||||
isFinal: node.isFinal,
|
||||
isLate: node.isLate,
|
||||
isImplicitlyTyped: node.isImplicitlyTyped);
|
||||
}
|
||||
flowAnalysis.initialize(
|
||||
node, initializerType, initializerResult.expression,
|
||||
isFinal: node.isFinal,
|
||||
isLate: node.isLate,
|
||||
isImplicitlyTyped: node.isImplicitlyTyped);
|
||||
initializerResult = ensureAssignableResult(node.type, initializerResult,
|
||||
fileOffset: node.fileOffset, isVoidAllowed: node.type is VoidType);
|
||||
Expression initializer = initializerResult.expression;
|
||||
|
|
Loading…
Reference in a new issue