File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -645,22 +645,20 @@ public func transcode<
645
645
646
646
var inputDecoder = inputEncoding. init ( )
647
647
var hadError = false
648
- var scalar = inputDecoder . decode ( & input )
649
- while !scalar . isEmptyInput ( ) {
650
- switch scalar {
648
+ loop:
649
+ while true {
650
+ switch inputDecoder . decode ( & input ) {
651
651
case . Result( let us) :
652
652
OutputEncoding . encode ( us, output: output)
653
653
case . EmptyInput:
654
- _sanityCheckFailure ( " should not enter the loop when input becomes empty " )
654
+ break loop
655
655
case . Error:
656
+ hadError = true
656
657
if stopOnError {
657
- return ( hadError: true )
658
- } else {
659
- OutputEncoding . encode ( " \u{fffd} " , output: output)
660
- hadError = true
658
+ break loop
661
659
}
660
+ OutputEncoding . encode ( " \u{fffd} " , output: output)
662
661
}
663
- scalar = inputDecoder. decode ( & input)
664
662
}
665
663
return hadError
666
664
}
You can’t perform that action at this time.
0 commit comments