Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: the compiler removes return statements sometimes #900

Closed
cgytrus opened this issue May 9, 2022 · 1 comment · Fixed by #1191
Closed

Bug: the compiler removes return statements sometimes #900

cgytrus opened this issue May 9, 2022 · 1 comment · Fixed by #1191
Labels
bug Something isn't working

Comments

@cgytrus
Copy link
Contributor

cgytrus commented May 9, 2022

Describe the bug

a return at the end of an if statement with other code in it removes the return when compiled

Reproducing steps

  1. Open a script (not sure if it works on the new functions thing, definitely works on legacy scripts)
  2. Put the following code at the beginning:
if(some_var) {
    do_something()
    return;
}
  1. Click away to compile the code
  2. Observe the return disappear

Setup Details

  1. commit 61d0f89
  2. win10 latest
  3. Will You Snail?
@cgytrus cgytrus added the bug Something isn't working label May 9, 2022
@Jacky720
Copy link
Contributor

This occurs because scripts automatically decompile with an unnecessary return at the end and I wanted to ignore that return to match bytecode. Thus, it can be fixed at AssemblyWriter.cs#1019, but maintaining 1:1 compilation will require removing the unnecessary return generation. Not that that's a high priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants