dotnet/roslyn

Remove extraneous branch for empty strings in interpolated string handler CFG

開放

#57,611 建立於 2021年11月5日

 (0 則留言) (0 個反應) (1 位負責人)C# (4,257 個分叉)batch import
Area-CompilersBugFeature - IOperationFeature - Interpolated String Improvementshelp wanted

倉庫指標

星標
 (20,414 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

When an interpolated string handler is created for an empty string, and the constructor of the handler uses an out bool success parameter, we generate an unnecessary branch in the CFG for the code, demonstrated in the InterpolatedStringHandlerConversionFlow_16 test. We could take the approach Aleksey detailed in his review to remove that branch, but we will have to wire a CreateDiscardSymbol method through the semantic model to be able to create an IDiscardOperation for the parameter value. This is presently undone.

貢獻者指南