@@ -645,7 +645,7 @@ fileprivate extension RawTriviaPiece {
645
645
}
646
646
}
647
647
648
- fileprivate extension Array where Element == RawTriviaPiece {
648
+ fileprivate extension RawTriviaPieceBuffer {
649
649
/// Walks and passes to `body` the ``SourceLength`` for every detected line,
650
650
/// with the newline character included.
651
651
/// - Returns: The leftover ``SourceLength`` at the end of the walk.
@@ -670,9 +670,16 @@ fileprivate extension TokenSyntax {
670
670
body: ( SourceLength ) -> ( )
671
671
) -> SourceLength {
672
672
var curPrefix = prefix
673
- curPrefix = self . tokenView. leadingRawTriviaPieces. forEachLineLength ( prefix: curPrefix, body: body)
674
- curPrefix = self . tokenView. rawText. forEachLineLength ( prefix: curPrefix, body: body)
675
- curPrefix = self . tokenView. trailingRawTriviaPieces. forEachLineLength ( prefix: curPrefix, body: body)
673
+ switch self . raw. rawData. payload {
674
+ case . parsedToken( let dat) :
675
+ curPrefix = dat. wholeText. forEachLineLength ( prefix: curPrefix, body: body)
676
+ case . materializedToken( let dat) :
677
+ curPrefix = dat. leadingTrivia. forEachLineLength ( prefix: curPrefix, body: body)
678
+ curPrefix = dat. tokenText. forEachLineLength ( prefix: curPrefix, body: body)
679
+ curPrefix = dat. trailingTrivia. forEachLineLength ( prefix: curPrefix, body: body)
680
+ case . layout( _) :
681
+ preconditionFailure ( " forEachLineLength is called non-token raw syntax " )
682
+ }
676
683
return curPrefix
677
684
}
678
685
}
0 commit comments