38c08f919d
Previously, the base `ExpressionInfo` class contained four fields: - `type`: the type of the expression. - `ifTrue`: a flow model describing the state of the program after the expression is evaluated, assuming the expression evaluates to `true`. - `ifFalse`: a flow model describing the state of the program after the expression is evaluated, assuming the expression evaluates to `false`. - `after`: a flow model describing the state of the prorgam after the expression is evaluated, making no assumptions about what value the expression evaluates to. The `after` field was largely redundant, since it tracked the same information as `FlowAnalysisImpl._current`. In fact, flow analysis contained a substantial amount of code to copy from `ExpressionInfo.after` to `FlowAnalysisImpl._current`, or vice versa, in order to keep the two in sync. The one exception was in `FlowAnalysisImpl.conditional_end`, which is called at the end of visiting a conditional expression (`e1 ? e2 : e3`): it joined the `after` flow models from `e2` and `e3` in order to determine the state of the program after the conditional expression completes. To preserve this behavior, a small amount of extra accounting logic had to be added to the handling of conditional expressions, to keep track of these flow models. (`e2.after` is now stored in `_ConditionalContext.thenModel`, and `e3.after` comes from the state of `_current` at the time of entry into `FlowAnalysisImpl.conditional_end`). Change-Id: I46e771f8b029550d43a5fe50366177f189a6a91d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388081 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Kallen Tu <kallentu@google.com>