Flow analysis: remove reachable arg of _clone.

No functional change. By default, `_clone` re-uses the reachability of
`this`. The `reachable` argument allowed the caller to override that
default. However, the only call site that used it passed in
`this.reachable`, so there was no effect.

Change-Id: I2b08e29a724b35efc531f4bcfbc6ec4a2a2519d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317443
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
Paul Berry 2023-08-01 19:31:29 +00:00 committed by Commit Queue
parent b9f7513c70
commit 89738cff69

View file

@ -2481,11 +2481,10 @@ class FlowModel<Type extends Object> {
return newModel ?? this;
}
/// Makes a copy of `this` that can be safely edited. Optional argument
/// [reachable] may be used to specify a different reachability.
FlowModel<Type> _clone({Reachability? reachable}) {
return new FlowModel<Type>.withInfo(reachable ?? this.reachable,
new Map<int, VariableModel<Type>>.of(variableInfo));
/// Makes a copy of `this` that can be safely edited.
FlowModel<Type> _clone() {
return new FlowModel<Type>.withInfo(
reachable, new Map<int, VariableModel<Type>>.of(variableInfo));
}
/// Common algorithm for [tryMarkNonNullable], [tryPromoteForTypeCast],
@ -2528,8 +2527,7 @@ class FlowModel<Type extends Object> {
assigned: info.assigned,
unassigned: info.unassigned,
ssaNode: info.ssaNode,
nonPromotionHistory: info.nonPromotionHistory),
reachable: reachable);
nonPromotionHistory: info.nonPromotionHistory));
}
/// Gets the info for [promotionKey] reference, creating it if it doesn't
@ -2540,9 +2538,8 @@ class FlowModel<Type extends Object> {
/// Returns a new [FlowModel] where the information for [reference] is
/// replaced with [model].
FlowModel<Type> _updateVariableInfo(
int promotionKey, VariableModel<Type> model,
{Reachability? reachable}) {
return _clone(reachable: reachable)..variableInfo[promotionKey] = model;
int promotionKey, VariableModel<Type> model) {
return _clone()..variableInfo[promotionKey] = model;
}
/// Forms a new state to reflect a control flow path that might have come from