@@ -374,7 +374,7 @@ open class BasicFormat: SyntaxRewriter {
374
374
375
375
/// This method does not consider any posssible mutations to `previousToken`
376
376
/// because newlines should be added to the next token's leading trivia.
377
- lazy var previousTokenWillEndWithNewline : Bool = {
377
+ let previousTokenWillEndWithNewline : Bool = {
378
378
guard let previousToken = previousToken else {
379
379
// Assume that the start of the tree is equivalent to a newline so we
380
380
// don't add a leading newline to the file.
@@ -386,7 +386,7 @@ open class BasicFormat: SyntaxRewriter {
386
386
return previousToken. isStringSegmentWithLastCharacterBeingNewline
387
387
} ( )
388
388
389
- lazy var previousTokenIsStringLiteralEndingInNewline : Bool = {
389
+ let previousTokenIsStringLiteralEndingInNewline : Bool = {
390
390
guard let previousToken = previousToken else {
391
391
// Assume that the start of the tree is equivalent to a newline so we
392
392
// don't add a leading newline to the file.
@@ -409,7 +409,7 @@ open class BasicFormat: SyntaxRewriter {
409
409
410
410
/// Also considers `nextToken` as starting with a leading newline if `token`
411
411
/// and `nextToken` should be separated by a newline.
412
- lazy var nextTokenWillStartWithNewline : Bool = {
412
+ let nextTokenWillStartWithNewline : Bool = {
413
413
guard let nextToken = nextToken else {
414
414
return false
415
415
}
@@ -426,16 +426,16 @@ open class BasicFormat: SyntaxRewriter {
426
426
return false
427
427
} ( )
428
428
429
+ var leadingTrivia = token. leadingTrivia
430
+ var trailingTrivia = token. trailingTrivia
431
+
429
432
/// This token's trailing trivia + any spaces or tabs at the start of the
430
433
/// next token's leading trivia.
431
- lazy var combinedTrailingTrivia : Trivia = {
434
+ let combinedTrailingTrivia : Trivia = {
432
435
let nextTokenLeadingWhitespace = nextToken? . leadingTrivia. prefix ( while: { $0. isSpaceOrTab } ) ?? [ ]
433
436
return trailingTrivia + Trivia( pieces: nextTokenLeadingWhitespace)
434
437
} ( )
435
438
436
- var leadingTrivia = token. leadingTrivia
437
- var trailingTrivia = token. trailingTrivia
438
-
439
439
if requiresNewline ( between: previousToken, and: token) {
440
440
// Add a leading newline if the token requires it unless
441
441
// - it already starts with a newline or
0 commit comments