Support for ternary expressions that span into multiple lines

Description

If expressions are long enough, spin the ternary expression into 3 lines, ex.:

Refer to SWC-858 for sample(s):

http://swiftify.me/b1jgw2

http://swiftify.me/b1jgw2/1

 

 

Note(s):

  1. If you can’t easily detect whether the original expression was span into multiple lines, you may reuse the ConversionOptions.MaxDestLineLength property to determine if the expression should be using a multiline syntax.

  2. See if we can support multi-level nested ternary expressions and convert them to a style similar to the original Objective-C style (rather than increasing the indentation for each line).

  3. It may be undesirable to span sub-expressions (like expressions passed to function parameters - see http://swiftify.me/h32u0n) into multiple lines (as least until we implement ).

Thus, I suggest that we currently support only top-level ternary expressions (that are part of a StatementContext) but exclude ternary expressions that are sub-expressions from being span into multiple lines.

Environment

None

Activity

Show:
Alex Petuschak
March 7, 2019, 4:36 PM
Edited
Alex Petuschak
October 17, 2019, 4:45 PM
Edited
Alex Petuschak
March 4, 2020, 1:48 PM
Edited

Assignee

Alex Petuschak

Reporter

Alex Petuschak

Labels

None

Git Branch Name

None

GitHub Issue

None

Components

Fix versions

Priority

Medium
Configure