579cbd80bd
I have run into a crash in the Analyzer when running `dart fix` on a
Flutter project.
minimal repro:
import 'package:flutter/widgets.dart';
void patternIssue(BuildContext context) {
if (true) {
final (string: string) = (string: "");
}
context.toString();
}
If one runs `dart fix --dry-run` on this file, it will throw
Computing fixes in exit_detector_bug (dry run)...
An unexpected error was encountered by the Analysis Server.
Please file an issue at https://github.com/dart-
lang/sdk/issues/new/choose with the following details:
Internal error: Exception while using a UseBuildContextSynchronously
to visit a MethodInvocationImpl in ExpressionStatementImpl in
BlockImpl in BlockFunctionBodyImpl in FunctionExpressionImpl in
FunctionDeclarationImpl in CompilationUnitImpl
Bad state: Missing a visit method for a node of type
PatternVariableDeclarationStatementImpl
I tracked this down to ExitDetector not having implementations for
various visit methods related to patterns.
I added these implementations and added a test.
R=cstefantsova@google.com
Change-Id: I7c090b261e9ceb53d9b50d0a931bffcec772f8d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Martin Kamleithner <martin.kamleithner@gmail.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>