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

Add codegen tests for subroutine local variables #622

Merged
merged 3 commits into from
Dec 23, 2022

Conversation

jasonpaulos
Copy link
Contributor

@jasonpaulos jasonpaulos commented Dec 22, 2022

Child PR to #606

This adds codegen tests to ensure subroutine local variables work properly, both with and without frame pointers.

@jasonpaulos jasonpaulos marked this pull request as ready for review December 22, 2022 22:57
@jasonpaulos jasonpaulos requested a review from ahangsu December 22, 2022 23:01
Comment on lines +1784 to +1794
if declaration.deferred_expr is not None:
# This is a hacky way to include the deferred expression in the resulting IR. It's only
# valid if there are no retsub opcodes anywhere in the subroutine.

for block in pt.TealBlock.Iterate(actual):
assert all(
op.op != pt.Op.retsub for op in block.ops
), "retsub present in subroutine, test code to apply deferred expression is no longer valid"

deferred, _ = declaration.deferred_expr.__teal__(options_v8)
actual_end.setNextBlock(deferred)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice move

Copy link
Contributor

@ahangsu ahangsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, testcases seem to be covering well. Thanks for adding more testcases.

@jasonpaulos jasonpaulos merged commit b3452f9 into feature/fp-local-var Dec 23, 2022
@jasonpaulos jasonpaulos deleted the fp-local-var-more-tests branch December 23, 2022 14:17
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.

2 participants