Implement isEnumConstant in ConstFieldElementImpl_EnumValue.

Change-Id: Icbb2dac7db5299a72294f31e119000bd8f535516
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222100
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2021-12-06 18:46:46 +00:00 committed by Commit Bot
parent 370a9d7b78
commit 24e681927a
2 changed files with 6 additions and 5 deletions

View file

@ -1296,6 +1296,9 @@ class ConstFieldElementImpl_EnumValue extends ConstFieldElementImpl_ofEnum {
@override
bool get hasInitializer => false;
@override
bool get isEnumConstant => true;
@override
Element get nonSynthetic => this;
@ -3284,10 +3287,7 @@ class FieldElementImpl extends PropertyInducingElementImpl
}
@override
bool get isEnumConstant =>
enclosingElement is ClassElement &&
(enclosingElement as ClassElement).isEnum &&
!isSynthetic;
bool get isEnumConstant => false;
@override
bool get isExternal {

View file

@ -173,7 +173,8 @@ class BundleWriter {
_sink._writeStringReference(element.name);
_resolutionSink._writeAnnotationList(element.metadata);
var constants = element.fields.where((e) => !e.isSynthetic).toList();
var constants =
element.fields.whereType<ConstFieldElementImpl_EnumValue>().toList();
_writeList<FieldElement>(constants, (field) {
_sink._writeStringReference(field.name);
_resolutionSink._writeAnnotationList(field.metadata);