Skip to content

Fix empty return statements not being emitted in bytecode.#38

Open
BenJilks wants to merge 1 commit intoarcticfox1919:mainfrom
BenJilks:empty-return-fix
Open

Fix empty return statements not being emitted in bytecode.#38
BenJilks wants to merge 1 commit intoarcticfox1919:mainfrom
BenJilks:empty-return-fix

Conversation

@BenJilks
Copy link
Copy Markdown

@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