nonSynthetic property
The non-synthetic element that caused this element to be created.
If this element is not synthetic, then the element itself is returned.
If this element is synthetic, then the corresponding non-synthetic element is returned. For example, for a synthetic getter of a non-synthetic field the field is returned; for a synthetic constructor the enclosing class is returned.
Implementation
@override
Element get nonSynthetic {
if (isSynthetic) {
if (enclosingElement3 is EnumElementImpl) {
// TODO(scheglov): remove 'index'?
if (name == 'index' || name == 'values') {
return enclosingElement3;
}
}
return (getter ?? setter)!;
} else {
return this;
}
}