7e5297e5f8
This change improves the fallback exhaustiveness algorithm so that it also takes advantage of the old, pre-patterns exhaustiveness logic for enums. This ensures that the fallback exhaustiveness algorithm won't seem like a regression to users who are used to the old pre-patterns behaviour. This required extending the old algorithm to handle new-style switch statements (which have a different representation from classic switch statements in the CFE) as well as switch expressions. We also turn on the fallback exhaustiveness algorithm by default. Unit tests can still disable it by temporarily setting the global variable `useFallbackExhaustivenessAlgorithm` to `false`. The hope is that this algorithm will be short-lived; we are just using it so that if we decide to enable pattern support in the near future, users will experience something that is sound. That is, it may require `default` or `_` cases more often than is strictly necessary, but it shouldn't ever allow a non-exhaustive switch in a place where an exhaustive switch is required. Change-Id: I4a8b7f996b109c4ee8832f286c3b3bf3b216fe8b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284840 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
Front end for Dart
This package provides a low-level API for use by compiler back ends that wish to implement the Dart language. It is intended for eventual use by dev_compiler, dart2js, and the Dart VM. In addition, it will share implementation details with the analyzer package--this will be accomplished by having the analyzer package import (and re-export) parts of this package's private implementation.
End-users should use the dart analyze
command-line tool to analyze their Dart code.
Integrators that want to write tools that analyze Dart code should use the analyzer package.
Note: A previous version of this package was published on pub.dev. It has now been marked DISCONTINUED as it is not intended for direct consumption, as per the notes above.