dart/web/6f3dd4e5f99bc93dfc200e277fa5c6dd154e9420
[js_interop_gen] Deduplicate `UnionType` and `IntersectionType` via `UnionOrIntersectionType` (#578)
* [js_interop_gen] Deduplicate `UnionType` and `IntersectionType` via `UnionOrIntersectionType`
Stacked on #577.
- Extract `sealed class UnionOrIntersectionType extends DeclarationType` in
`lib/src/ast/types.dart` (mirroring `_UnionOrIntersectionDeclaration`) to
share `types`, `isNullable`, `declarationName`, `id`, `emit()`, `hashCode`,
and `operator ==` across `UnionType` and `IntersectionType` (`pkg:dedupe`
`cluster-47`).
- Fix `UnionType.==` and `IntersectionType.==`, which previously checked
`other is TupleType` due to copy-paste.
- Consolidate `UnionType` / `IntersectionType` pattern cases in
`lib/src/ast/helpers.dart` and
`lib/src/interop_gen/transform/dependency_walker.dart`.
- Write `dart_main.js` via an atomic temporary file rename in
`compileDartMain()` (`lib/src/cli.dart`) so parallel `dart test` isolates in
the same VM process cannot truncate `dart_main.js` while `node main.mjs` is
loading it.
* Enforce symmetric equality and length check in UnionOrIntersectionType.==
3 files changed