Skip to content

Commit 1cd44e6

Browse files
authored
Allow null staticElement for const constructors (#2176)
1 parent e028609 commit 1cd44e6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/src/model/getter_setter_combo.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ mixin GetterSetterCombo on ModelElement {
5252
.toString();
5353
Element staticElement =
5454
(constantInitializer as InstanceCreationExpression).staticElement;
55+
assert(staticElement != null,
56+
'${original} should be able to be resolved but an analysis error prevents this');
57+
if (staticElement == null) return original;
5558
Constructor target = ModelElement.fromElement(staticElement, packageGraph);
5659
Class targetClass = target.enclosingElement;
5760
// TODO(jcollins-g): this logic really should be integrated into Constructor,

0 commit comments

Comments
 (0)