fix break in try-catch-finally #1279
Closed
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.
Partially handles #1278 , for
break
only.continue
andgoto
will be handled in the future.This PR creates statement stack to find the target for a
break
.break
from multi-layered nestedtry
has been solved.It's good if compilers of other languages check this issue as well:
Old stacks to find break and continue targets may be removed in the future.
Also fixed bug in optimizer that, the instruction coverage analyzer cannot correctly judge whether a function call throws or aborts, when the function is called in a
try
context. In the optimizer where the exception state is being judged, the called function should not run with the caller's try stack context.With this PR, there may still be a potential compiler problem in
break
, when the compiled source codes call another function. In a called function, the break targets in the statement context stack in the caller stack should be segregated, but my codes do not do so. I think the C# syntax analyzer should stop the compiler if there is an invalid break like this, but I am not 100% sure.Soviet Zeppelin, dangerous machine~
Soviet Zeppelin, iron discipline~