From 0d4c54d2a299643ba2a783ef2e9fcf878305a62d Mon Sep 17 00:00:00 2001 From: Konstantin Scheglov Date: Mon, 29 Aug 2022 10:03:51 -0700 Subject: [PATCH] Prepare for separation of ClassElement, EnumElement and MixinElement. (#617) * Prepare for separation of ClassElement, EnumElement and MixinElement. * Throw explicitly. --- source_gen/lib/src/constants/revive.dart | 2 +- source_gen/test/generator_for_annotation_test.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source_gen/lib/src/constants/revive.dart b/source_gen/lib/src/constants/revive.dart index 473464a8..e5c2b1ee 100644 --- a/source_gen/lib/src/constants/revive.dart +++ b/source_gen/lib/src/constants/revive.dart @@ -44,7 +44,7 @@ Revivable reviveInstance(DartObject object, [LibraryElement? origin]) { ); } - if (element is ClassElement) { + if (element is InterfaceElement) { for (final e in element.fields.where( (f) => f.isPublic && f.isConst && f.computeConstantValue() == object, )) { diff --git a/source_gen/test/generator_for_annotation_test.dart b/source_gen/test/generator_for_annotation_test.dart index 8a0cd8d4..8c93e50b 100644 --- a/source_gen/test/generator_for_annotation_test.dart +++ b/source_gen/test/generator_for_annotation_test.dart @@ -197,7 +197,7 @@ class _TestingResolver implements ReleasableResolver { bool allowSyntaxErrors = false, }) async { resolvedLibs.add(assetId); - return null as LibraryElement; + throw StateError('This method intentionally throws'); } @override