Use unique instance of NeverElementImpl.

Change-Id: Ie69d563b0e4c86100b3c098dba8832af7a2edae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251782
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2022-07-18 17:04:23 +00:00 committed by Commit Bot
parent 6bbe04d40f
commit 6ca5af86fe
2 changed files with 4 additions and 4 deletions

View file

@ -5161,14 +5161,14 @@ class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
/// The synthetic element representing the declaration of the type `Never`.
class NeverElementImpl extends ElementImpl implements TypeDefiningElement {
/// Return the unique instance of this class.
static NeverElementImpl get instance => NeverTypeImpl.instance.element;
/// The unique instance of this class.
static final instance = NeverElementImpl._();
/// Initialize a newly created instance of this class. Instances of this class
/// should <b>not</b> be created except as part of creating the type
/// associated with this element. The single instance of this class should be
/// accessed through the method [instance].
NeverElementImpl() : super('Never', -1) {
NeverElementImpl._() : super('Never', -1) {
setModifier(Modifier.SYNTHETIC, true);
}

View file

@ -894,7 +894,7 @@ class NeverTypeImpl extends TypeImpl implements NeverType {
final NullabilitySuffix nullabilitySuffix;
/// Prevent the creation of instances of this class.
NeverTypeImpl._(this.nullabilitySuffix) : super(NeverElementImpl());
NeverTypeImpl._(this.nullabilitySuffix) : super(NeverElementImpl.instance);
@override
NeverElementImpl get element => super.element as NeverElementImpl;