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

Fix returns/multiple scripts in GMS2.3+ #1191

Merged
merged 8 commits into from
Mar 2, 2023

Conversation

Jacky720
Copy link
Contributor

@Jacky720 Jacky720 commented Feb 27, 2023

Description

GMS 2.3 scripts always produce an exit instruction, even for scripts lacking a return. UTMT previously interpreted this as a return anyway, and the workaround of ignoring returns on the top level block caused issue #900. (This closes #900).

Commit 60ea473 additionally adds support for changing the offset, length, and argument counts of anonymous script entries, and creating new ones by simply invoking function, during script compilation.

Caveats

The new workaround takes the list of blocks and Sort()s its keys to peek at the next and identify the extraneous exits. This may result in performance degradation for complex scripts with many blocks and many returns.

Notes

N/A

heavily optimizable most likely
It might be more readable to condense all of these checks into however many nested ifs resulting in a boolean. "dontProduceStatement" or somesuch
@github-actions
Copy link

github-actions bot commented Feb 27, 2023

@Jacky720 Jacky720 changed the title Fix returns in GMS2.3+ Fix returns/multiple scripts in GMS2.3+ Mar 2, 2023
@Grossley Grossley merged commit 277c688 into UnderminersTeam:master Mar 2, 2023
This was referenced Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: the compiler removes return statements sometimes
3 participants