Delphi 13 added a new if-expression syntax similar to ?: from other languages (documentation).
Since this operator is intended for terse code, pasfmt should try to format such expressions inline as much as possible.
Examples of the (proposed) desired formatting include
A := if B then C else D;
Foo(if B then C else D);
if (if B then C else D) > 10 then
Foo
else
Bar;
In cases where a line break is forced, or it doesn't fit on one line, we should revert to the existing formatting for if-then-else statements, with continuations appropriate for the context:
A := //
if B then
C
else
D;
Foo( //
if B then
C
else
D;
);
if ( //
if B then
C
else
D)
> 10 then
Foo
else
Bar;
Delphi 13 added a new if-expression syntax similar to
?:from other languages (documentation).Since this operator is intended for terse code, pasfmt should try to format such expressions inline as much as possible.
Examples of the (proposed) desired formatting include
In cases where a line break is forced, or it doesn't fit on one line, we should revert to the existing formatting for if-then-else statements, with continuations appropriate for the context: