@@ -510,30 +510,20 @@ mixin PieceFactory {
510510 if (forParts.updaters.isNotEmpty) {
511511 partsList.addCommentsBefore (forParts.updaters.first.beginToken);
512512
513- DelimitedListBuilder updaterBuilder;
514- if (isVersion37) {
515- // Create a nested list builder for the updaters so that they can
516- // remain unsplit even while the clauses split.
517- updaterBuilder = DelimitedListBuilder (
518- this ,
519- const ListStyle (commas: Commas .nonTrailing),
520- );
521- } else {
522- // Unlike most places in the language, if the updaters split, we
523- // don't want to add a trailing comma. But if the user has preserve
524- // trailing commas on, we should preserve the comma if there is one
525- // but not add one if there isn't and it splits.
526- var style = const ListStyle (commas: Commas .nonTrailing);
527- if (formatter.trailingCommas == TrailingCommas .preserve &&
528- rightParenthesis.hasCommaBefore) {
529- style = const ListStyle (commas: Commas .trailing);
530- }
531-
532- // Create a nested list builder for the updaters so that they can
533- // remain unsplit even while the clauses split.
534- updaterBuilder = DelimitedListBuilder (this , style);
513+ // Unlike most places in the language, if the updaters split, we
514+ // don't want to add a trailing comma. But if the user has preserve
515+ // trailing commas on, we should preserve the comma if there is one
516+ // but not add one if there isn't and it splits.
517+ var style = const ListStyle (commas: Commas .nonTrailing);
518+ if (formatter.trailingCommas == TrailingCommas .preserve &&
519+ rightParenthesis.hasCommaBefore) {
520+ style = const ListStyle (commas: Commas .trailing);
535521 }
536522
523+ // Create a nested list builder for the updaters so that they can
524+ // remain unsplit even while the clauses split.
525+ var updaterBuilder = DelimitedListBuilder (this , style);
526+
537527 forParts.updaters.forEach (updaterBuilder.visit);
538528
539529 // Add the updater builder to the clause builder so that any comments
@@ -1793,7 +1783,6 @@ mixin PieceFactory {
17931783 /// Whether there is a trailing comma at the end of the list delimited by
17941784 /// [rightBracket] which should be preserved.
17951785 bool hasPreservedTrailingComma (Token rightBracket) =>
1796- ! isVersion37 &&
17971786 formatter.trailingCommas == TrailingCommas .preserve &&
17981787 rightBracket.hasCommaBefore;
17991788
0 commit comments