Skip to content

transform: rewrite result/return before annotate #336

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

Merged
merged 1 commit into from
Mar 28, 2025

Conversation

alaviss
Copy link
Contributor

@alaviss alaviss commented Mar 28, 2025

Previously we unconditionally rewrite return with the assumption that all return belongs to the procedure being rewritten. This does not hold when nested procedures are used. This issue was exposed thanks to nim-works/nimskull#1503 breaking an implicit dependency on the compiler's automatic result transformation for implicit returns.

This commit separate return rewrite from annotate and merge it with the result rewrite, as both require awareness of nested procedures.

Previously we unconditionally rewrite `return` with the assumption that
all return belongs to the procedure being rewritten. This does not hold
when nested procedures are used. This issue was exposed thanks to
nim-works/nimskull#1503 breaking an implicit
dependency on the compiler's automatic result transformation for
implicit returns.

This commit separate return rewrite from annotate and merge it with the
result rewrite, as both require awareness of nested procedures.
@alaviss alaviss added the bug Something isn't working label Mar 28, 2025
@disruptek disruptek merged commit 753fd9a into master Mar 28, 2025
5 of 6 checks passed
@disruptek disruptek deleted the leorize/push-nnypnvqvtysk branch March 28, 2025 12:00
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 this pull request may close these issues.

2 participants