Files
sdk/pkg/kernel/lib
Paul Berry 0c7585c907 Start building a shared class hierarchy for types.
This commit introduces the following new classes:

- SharedType, which represents the common interface between the
  DartType classes in the analyzer and the CFE.

- SharedRecordType, which represents the common interface between the
  RecordType classes in the analyzer and the CFE.

- SharedNamedType, which represents the common interface between the
  analyzer and CFE representations of a name/type pair.

- SharedUnknownType, which represents the common interface between the
  analyzer and CFE representations of the unknown type (`_`).

This allowed three methods to be removed from the
`TypeAnalyzerOperations` class:

- `areStructurallyEqual`, which is replaced by
  `SharedType.isStructurallyEqualTo`.

- `asRecordType`, which is no longer needed because `is
  SharedRecordType` can be used instead.

- `isUnknownType`, which is no longer needed because `is
  SharedUnknownType` can be used instead.

And one method to be removed from the `FlowAnalysisTypeOperations`
class:

- `isSameType`, which is replaced by `operator ==`. (Technically this
  could have been done even without introducing a shared class
  hierarchy, since `operator ==` is defined in the shared base class
  `Object`).

The long term goal is to fill out the shared class hierarchy to cover
other kinds of types (interface types, function types, void, etc.),
and to move most of the shared logic from the analyzer and CFE
DartType class hierarchies into shared code. This should reduce the
risk of implementation skew between the analyzer and CFE, and to
streamline the implementation of future features. Additionally, the
hope is to eventually remove, or drastically simplify, classes like
`TypeAnalyzerOperations`, so that the code in `_fe_analyzer_shared`
can be written in simpler and more straightforward way.

Change-Id: I5d3a929057959f77ccff8dbed5671f9bca6259c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-05-01 16:41:47 +00:00
..
2024-02-29 17:28:01 +00:00
2024-02-29 17:28:01 +00:00
2024-02-29 17:28:01 +00:00
2024-02-29 07:42:58 +00:00