Address a review comment that keeps getting missed

Change-Id: I74b0b77da6524300ee3cd4c6a32ce0b225391eab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352048
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Brian Wilkerson 2024-02-13 17:11:29 +00:00 committed by Commit Queue
parent 03f797a85a
commit e349b3faef

View file

@ -2519,7 +2519,6 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
/// beginning of a redirecting constructor invocation.
void _forRedirectingConstructorInvocation(
ConstructorDeclaration constructor) {
var constructorName = constructor.name?.lexeme;
var container = constructor.parent;
var thisType = switch (container) {
ClassDeclaration() => container.declaredElement?.thisType,
@ -2528,6 +2527,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
_ => null,
};
if (thisType != null) {
var constructorName = constructor.name?.lexeme;
declarationHelper(mustBeConstant: constructor.constKeyword != null)
.addConstructorNamesForType(type: thisType, exclude: constructorName);
}