Skip to content

Commit da66902

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Fix a bug in constructor element display string (issue 37165)
Change-Id: Ie5fe3b5c4e78be67887cf56e4698554d44095fd0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105349 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 85cadff commit da66902

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,12 +2725,12 @@ class ConstructorElementImpl extends ExecutableElementImpl
27252725
@override
27262726
void appendTo(StringBuffer buffer) {
27272727
String name;
2728+
String constructorName = displayName;
27282729
if (enclosingElement == null) {
27292730
String message;
2730-
String name = displayName;
2731-
if (name != null && !name.isEmpty) {
2731+
if (constructorName != null && !constructorName.isEmpty) {
27322732
message =
2733-
'Found constructor element named $name with no enclosing element';
2733+
'Found constructor element named $constructorName with no enclosing element';
27342734
} else {
27352735
message = 'Found unnamed constructor element with no enclosing element';
27362736
}
@@ -2739,7 +2739,6 @@ class ConstructorElementImpl extends ExecutableElementImpl
27392739
} else {
27402740
name = enclosingElement.displayName;
27412741
}
2742-
String constructorName = displayName;
27432742
if (constructorName != null && !constructorName.isEmpty) {
27442743
name = '$name.$constructorName';
27452744
}

0 commit comments

Comments
 (0)