diff --git a/src/format/parser.d b/src/format/parser.d index 41aaad5a0..53d0f4e52 100644 --- a/src/format/parser.d +++ b/src/format/parser.d @@ -2423,6 +2423,7 @@ private: bool parseFunctionPostfix() { auto guard = span!IndentSpan(2); + int nNewSyntaxContracts = 0; while (true) { clearSeparator(); @@ -2445,6 +2446,11 @@ private: if (lookahead.front.type == OpenBrace) { nextToken(); goto ContractBlock; + } else { + ++nNewSyntaxContracts; + if (nNewSyntaxContracts > 1) { + newline(); + } } split(); @@ -2459,6 +2465,11 @@ private: if (lookahead.front.type == OpenBrace) { nextToken(); goto ContractBlock; + } else { + ++nNewSyntaxContracts; + if (nNewSyntaxContracts > 1) { + newline(); + } } split(); diff --git a/src/format/span.d b/src/format/span.d index 3a53ee830..316a8c92e 100644 --- a/src/format/span.d +++ b/src/format/span.d @@ -330,10 +330,9 @@ final class ListSpan : Span { return trailingSplit != size_t.max; } - void registerElement(size_t i) in { - assert(elements.length == 0 || elements[$ - 1] <= i); - assert(!hasTrailingSplit); - } do { + void registerElement(size_t i) + in(elements.length == 0 || elements[$ - 1] <= i) + in(!hasTrailingSplit) { import std.algorithm; headerSplit = min(i, headerSplit); @@ -345,11 +344,9 @@ final class ListSpan : Span { headerSplit = i; } - void registerTrailingSplit(size_t i) in { - assert(elements.length > 0); - assert(elements[$ - 1] <= i); - assert(!hasTrailingSplit); - } do { + void registerTrailingSplit(size_t i) in(elements.length > 0) + in(elements[$ - 1] <= i) + in(!hasTrailingSplit) { trailingSplit = i; if (elements.length > 1) {