[vm/aot/tfa] Cleanup obsolete handling of instance fields of enum classes

Enum index and name instance fields were moved to a base class (_Enum)
and tree shaker no longer needs to keep instance fields of enum classes.

TEST=ci

Change-Id: I2426a0bc37f11e51ca00aa24f981e4663d5fb358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255543
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2022-08-22 16:20:59 +00:00 committed by Commit Bot
parent e2d6cb69fb
commit 65b7d62bf1

View file

@ -769,17 +769,7 @@ class TreeShaker {
mayHaveSideEffects(f.initializer!)) ||
(f.isLate && f.isFinal) ||
isFieldFinalizable(f)) ||
isMemberReferencedFromNativeCode(f) ||
_isInstanceFieldOfAllocatedEnum(f);
/// Preserve instance fields of allocated enums as VM relies on their
/// existence. Non-allocated enums are converted into ordinary classes during
/// the 2nd pass.
bool _isInstanceFieldOfAllocatedEnum(Field node) =>
!node.isStatic &&
node.enclosingClass != null &&
node.enclosingClass!.isEnum &&
isClassAllocated(node.enclosingClass!);
isMemberReferencedFromNativeCode(f);
void addClassUsedInType(Class c) {
if (_classesUsedInType.add(c)) {