Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/front_end/piece_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,8 @@ mixin PieceFactory {
pieces.token(catchKeyword);
pieces.space();

var parameters = DelimitedListBuilder(this);
var parameters = DelimitedListBuilder(
this, const ListStyle(commas: Commas.nonTrailing));
parameters.leftBracket(catchClause.leftParenthesis!);
if (catchClause.exceptionParameter case var exceptionParameter?) {
parameters.visit(exceptionParameter);
Expand Down
31 changes: 30 additions & 1 deletion test/tall/statement/try.stmt
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,33 @@ try {
} on FooException {
} on BarException {
doSomething();
}
}
>>> Split inside catch clause without stack trace.
try {
doSomething();
} catch (someSurprisinglyLongVariableName) {
doSomething();
}
<<<
try {
doSomething();
} catch (
someSurprisinglyLongVariableName
) {
doSomething();
}
>>> Split inside catch clause with stack trace.
try {
doSomething();
} catch (longErrorVariable, longStackTrace) {
doSomething();
}
<<<
try {
doSomething();
} catch (
longErrorVariable,
longStackTrace
) {
doSomething();
}
4 changes: 2 additions & 2 deletions test/tall/statement/try_comment.stmt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ try {
body;
} catch (
// comment
e,
e
) {
print(e);
}
Expand All @@ -38,7 +38,7 @@ try { body; } catch (e// comment
try {
body;
} catch (
e, // comment
e // comment
) {
print(e);
}
Expand Down