neo-project / neo-devpack-dotnet

NEO Development Pack
MIT License
79 stars 100 forks source link

fix deleting codes after finally when `catch` may throw #1098

Closed Hecate2 closed 1 month ago

Hecate2 commented 1 month ago

Sorry for still having bugs... https://github.com/neo-project/neo-devpack-dotnet/pull/1096 https://github.com/Jim8y/neo-devpack-dotnet/blob/95a718cc2d10c3cc66b5b7a6c7587a82c0c91622/tests/Neo.Compiler.CSharp.TestContracts/Contract_TryCatch.cs#L101-L120 This method demonstrates the error of the optimizer in master. The optimizer deletes all the codes after finally because it visits the throw in catch, and then visits finally (without visiting codes after finally). Then when we do not throw in catch, the optimizer thinks finally has been visited well, and never visits the codes after finally.

shargon commented 1 month ago

UT Fault