Make some bool fields in nullability_node non-nullable

Change-Id: If50538f4e4c189d45af0a2c22e7a6a19a29c7f68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265080
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This commit is contained in:
Sam Rawlins 2022-10-21 13:23:57 +00:00 committed by Commit Queue
parent e20d10ea38
commit e7c590b137

View file

@ -84,15 +84,17 @@ class NullabilityEdge implements EdgeInfo {
final String description; final String description;
/// Whether this edge is the result of an uninitialized variable declaration. /// Whether this edge is the result of an uninitialized variable declaration.
final bool? isUninit; final bool isUninit;
/// Whether this edge is the result of an assignment within the test package's /// Whether this edge is the result of an assignment within the test package's
/// `setUp` function. /// `setUp` function.
final bool? isSetupAssignment; final bool isSetupAssignment;
NullabilityEdge._( NullabilityEdge._(
this.destinationNode, this.upstreamNodes, this._kind, this.description, this.destinationNode, this.upstreamNodes, this._kind, this.description,
{this.codeReference, this.isUninit, this.isSetupAssignment}); {this.codeReference,
this.isUninit = false,
this.isSetupAssignment = false});
@override @override
Iterable<NullabilityNode?> get guards => upstreamNodes.skip(1); Iterable<NullabilityNode?> get guards => upstreamNodes.skip(1);
@ -964,11 +966,11 @@ class _PropagationState {
var edge = step.edge; var edge = step.edge;
if (!edge.isTriggered) continue; if (!edge.isTriggered) continue;
var node = edge.destinationNode; var node = edge.destinationNode;
if (edge.isUninit! && !node.isNullable) { if (edge.isUninit && !node.isNullable) {
// [edge] is an edge from always to an uninitialized variable // [edge] is an edge from always to an uninitialized variable
// declaration. // declaration.
var isSetupAssigned = node.upstreamEdges var isSetupAssigned = node.upstreamEdges
.any((e) => e is NullabilityEdge && e.isSetupAssignment!); .any((e) => e is NullabilityEdge && e.isSetupAssignment);
// Whether all downstream edges go to nodes with non-null intent. // Whether all downstream edges go to nodes with non-null intent.
var allDownstreamHaveNonNullIntent = false; var allDownstreamHaveNonNullIntent = false;