Skip to content

Conversation

Hecate2
Copy link
Contributor

@Hecate2 Hecate2 commented Jan 15, 2025

Partially handles #1278 , for break only. continue and goto will be handled in the future.
This PR creates statement stack to find the target for a break. break from multi-layered nested try has been solved.
It's good if compilers of other languages check this issue as well:

for:
  try:
    try:
      break
    finally:
      ...
  finally:
    ...

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~

@Hecate2 Hecate2 requested review from Jim8y and shargon and removed request for Jim8y January 16, 2025 05:12
@Jim8y
Copy link
Contributor

Jim8y commented Jan 16, 2025

i need sometime to review this.pr

@Hecate2 Hecate2 mentioned this pull request Jan 20, 2025
@Hecate2
Copy link
Contributor Author

Hecate2 commented Jan 21, 2025

Done in #1282

@Hecate2 Hecate2 closed this Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants