@@ -645,7 +645,7 @@ fileprivate extension RawTriviaPiece {
645645 }
646646}
647647
648- fileprivate extension Array where Element == RawTriviaPiece {
648+ fileprivate extension RawTriviaPieceBuffer {
649649 /// Walks and passes to `body` the ``SourceLength`` for every detected line,
650650 /// with the newline character included.
651651 /// - Returns: The leftover ``SourceLength`` at the end of the walk.
@@ -670,9 +670,16 @@ fileprivate extension TokenSyntax {
670670 body: ( SourceLength ) -> ( )
671671 ) -> SourceLength {
672672 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+ }
676683 return curPrefix
677684 }
678685}
0 commit comments