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 empty return statements not being emitted in bytecode. #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BenJilks
Copy link

@BenJilks BenJilks commented Dec 3, 2024

Fixes issue #34.

To determine if a block has a return statement, it was checking if retExps is empty. However, if an empty return statement was given (for example, in the code below), this would also be empty. Meaning the RETURN bytecode was never emitted.

function test()
    if true then
        return
    end
    print("should not get here")
end

This PR makes block retExps optional. This value being null means there was no return statement at the end of the block. It being an empty list, means an empty return statement.

This patch makes block `retExps` optional. This value being `null`
means there was no return statement at the end of the block. It being an
empty list, means an empty return statement.
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.

1 participant