-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
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;checkdigits
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request