[cfe] Fix printing of catch clauses with new CatchVariables

Since `CatchVariable`s don't have initializers, the print method in
the `Catch` node shouldn't attempt to print it.

Part of https://github.com/dart-lang/sdk/issues/61572

Change-Id: I548e80e0f95c20a0537392faccd5c1fc11d844d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497980
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
Chloe Stefantsova
2026-05-11 04:46:43 -07:00
parent 8df966741d
commit 7d2b344a7e
+1
View File
@@ -1326,6 +1326,7 @@ class Catch extends TreeNode implements ScopeProvider {
printer.writeVariableInitialization(
exception!,
includeModifiersAndType: false,
includeInitializer: false,
);
if (stackTrace != null) {
printer.write(', ');