Flow analysis: remove logic to handle implicitly declared variables.

The analyzer and CFE now properly declare all variables, so we don't
need this logic anymore.

Change-Id: I8e0075fe78986685f4b3749b3c20d1d3610cc4af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278538
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
Paul Berry 2023-01-10 13:24:01 +00:00 committed by Commit Queue
parent 6d0237a79b
commit 6a4a6a167d

View file

@ -3457,12 +3457,14 @@ class _FlowAnalysisImpl<Node extends Object, Statement extends Node,
if (!_assignedVariables.isFinished) {
_assignedVariables.finish();
}
AssignedVariablesNodeInfo anywhere = _assignedVariables.anywhere;
Set<int> implicitlyDeclaredVars = {...anywhere.read, ...anywhere.written};
implicitlyDeclaredVars.removeAll(anywhere.declared);
for (int variableKey in implicitlyDeclaredVars) {
_current = _current.declare(variableKey, true);
}
assert(() {
AssignedVariablesNodeInfo anywhere = _assignedVariables.anywhere;
Set<int> implicitlyDeclaredVars = {...anywhere.read, ...anywhere.written};
implicitlyDeclaredVars.removeAll(anywhere.declared);
assert(implicitlyDeclaredVars.isEmpty,
'All variables should be declared somewhere');
return true;
}());
}
@override