Skip to content

Commit

Permalink
Perf: short-circuit (+>) in ShortExpression mode (#919)
Browse files Browse the repository at this point in the history
* Shortcut (+>) when ConfirmedMultiline

* clean
  • Loading branch information
jindraivanek committed Jun 13, 2020
1 parent 2a4e344 commit f502c77
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Fantomas/Context.fs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ let internal atCurrentColumnIndent (f : _ -> Context) (ctx : Context) =

/// Function composition operator
let internal (+>) (ctx : Context -> Context) (f : _ -> Context) x =
f (ctx x)
let y = ctx x
match y.WriterModel.Mode with
| ShortExpression infos when infos |> Seq.exists (fun x -> x.ConfirmedMultiline) -> y
| _ -> f y

/// Break-line and append specified string
let internal (++) (ctx : Context -> Context) (str : string) x =
Expand Down

0 comments on commit f502c77

Please sign in to comment.