You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In https://dart-review.googlesource.com/c/sdk/+/278649, I added
assertions to flow analysis to make sure that `FlowAnalysis.declare`
wasn't called more times than necessary. To work around a few instance
in which it _was_ being called more than necessary, I added a
parameter `skipDuplicateCheck` that caused the assertion to be
skipped.
This change fixes the one remaining case in which skipping the check
was necessary, by moving the CFE logic that calls
`FlowAnalysis.declare` for formal parameters. Previously, this logic
was in both `BodyBuilder.finishFunction` and
`BodyBuilder.finishConstructor`, resulting in some duplication because
`BodyBuilder.finishFunction` sometimes calls
`BodyBuilder.finishConstructor`. I've moved the logic into a new
method, `BodyBuilder._declareFormals`, which is called from
`BodyBuilder.finishFunction` and `BodyBuilder.parseInitializers`,
ensuring that the calls to `FlowAnalysis.declare` only occur once.
Fixing this case allows the `skipDuplicateCheck` hack to be removed
entirely.
Note that there was also one place where the analyzer was also using
`skipDuplicateCheck`, but it was doing so unnecessarily.
Change-Id: Ic34d1b7120f05d94c53774d52eb90e4ada67415f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434261
Commit-Queue: Paul Berry <[email protected]>
Reviewed-by: Chloe Stefantsova <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
0 commit comments