Repository navigation
fix(js): keep finally blocks reachable after return or throw (#172) - #205
Merged
Merged
Conversation
DaisukeYoda
force-pushed
the
fix/172-finally-reachability
branch
from
October 15, 2026 02:18
4b44ba2 to
cb87132
Compare
DaisukeYoda
force-pushed
the
fix/172-finally-reachability
branch
from
October 15, 2026 02:19
cb87132 to
9abfc85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #172.
A
finallyblock runs however itstryorcatchends. The CFG builder connected thetryandcatchto thefinallyblock only when they completed normally, so afinallyafter areturn,throw,breakorcontinuewas reported asunreachable_branch.The builder now adds an exception edge into the
finallyblock from thetryblock, or from thecatchblock when there is one. That edge stands for every abrupt exit, so thefinallyblock is reachable whenever thetryis. Thefinallyblock connects to the code after thetryonly when the end of thetryorcatchis reachable from the start of thetryand does not end with a jump, soafter()intry { return } finally { ... } after()is still reported. Exception edges do not count toward cyclomatic complexity, so complexity does not change.