Commit 3a67a7d
[front end] Unify methods for making a type nullable.
Previously, there were three methods with slightly different behaviors:
- `OperationsCfe.makeNullableInternal`, which simply added `?` to the
type.
- `OperationsCfe.getNullableType`, which contained special logic for
intersection types, and also maintained a cache to minimize the
number of type objects that needed to be allocated.
- `InferenceVisitorBase.computeNullable`, which also coerced `Never?`
to `Null`.
With this change, there is just one core implementation,
`OperationsCfe.makeNullableInternal`, with all of these behaviors, and
then `InferenceVisitorBase.computeNullable` is a convenience method
that calls it.
Change-Id: I7b6a442d0f3ba66e89d39c50cf240f021344e4aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398420
Commit-Queue: Chloe Stefantsova <[email protected]>
Auto-Submit: Paul Berry <[email protected]>
Reviewed-by: Chloe Stefantsova <[email protected]>1 parent 1baa8ca commit 3a67a7d
File tree
3 files changed
+20
-25
lines changed- pkg/front_end/lib/src/type_inference
3 files changed
+20
-25
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6824 | 6824 | | |
6825 | 6825 | | |
6826 | 6826 | | |
6827 | | - | |
6828 | | - | |
| 6827 | + | |
| 6828 | + | |
6829 | 6829 | | |
6830 | 6830 | | |
6831 | 6831 | | |
| |||
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 197 | + | |
| 198 | + | |
203 | 199 | | |
204 | 200 | | |
205 | 201 | | |
| |||
Lines changed: 16 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | 639 | | |
656 | 640 | | |
657 | 641 | | |
| |||
763 | 747 | | |
764 | 748 | | |
765 | 749 | | |
766 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
767 | 766 | | |
768 | 767 | | |
769 | 768 | | |
| |||
0 commit comments