Files
sdk/pkg/_fe_analyzer_shared
Paul Berry a226405a70 [flow analysis] Improve how catch clauses are modeled in tests.
This change updates the mini_ast testing infrastructure so that:

- It properly models the "exception type" part of a catch clause (the
  type named after the `on` keyword).

- It requires an exception variable to be specified if there is a
  stack trace variable (this is required by the Dart grammar).

- It requires an exception type to be specified if there is no
  exception variable (this is required by the Dart grammar).

- During the "pre-visit" stage, the exception variable and stack trace
  variable are registered with the `AssignedVariables` object, so that
  they can be properly handled by type promotion.

- During the main "visit" stage, the exception variable and stack
  trace variable are assigned the appropriate types.

Flow analysis unit tests are updated in order to meet the new
requirements, and flow analysis tests are added to check that stack
trace and exception variables are promotable and appropriately typed.

By ensuring that stack trace and exception variables are properly
typed during flow analysis tests, this paves the way for some
follow-up work, in which I plan to re-work how flow analysis keeps
track of variable types.

There is no behavioral change to the analyzer or compiler pipeline;
these changes are confined to `pkg/_fe_analyzer_shared/test`.

Change-Id: I49c4b894d82d1dc58d62e3d3f25d232c9106922e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434145
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-12 20:45:35 -07:00
..
2025-02-19 09:33:31 -08:00

FE/analyzer shared code

This package contains logic that is shared between the front_end and analyzer packages. It is intended solely to facilitate development of the Dart SDK, and is not intended for use by end users. In particular, this package has no public API, so no guarantee is made of compatibility between one version of the package and the next.

End users should consider using the analyzer package to analyze Dart source code.