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

feat: lower aggregate return types #1379

Draft
wants to merge 55 commits into
base: master
Choose a base branch
from
Draft

feat: lower aggregate return types #1379

wants to merge 55 commits into from

Conversation

mhasel
Copy link
Member

@mhasel mhasel commented Dec 20, 2024

Introduce a lowering stage for function and method calls

  • Methods and functions returning strings will now be changed during a lowering phase (index and annotation) to have the an extra parameter to contain the return type.
    This used to be done on the codegen level but has now been moved to an earlier stage which would reduce the logic added to codegen to handle different types of returns.
  • Introduce an "alloca" ast keyword that creates temporary variables on demand, this is needed to support re-writing the method and function calls with temporary variables.
    Note this currently causes a side effect in if/else blocks where an else condition will be evaluated even if the if condition is true, this will be fixed at a later point.
    For the same reason, WHILE and REPEAT..UNTIL loops are now lowered to WHILE TRUE loops, with a break-condition in the loop-body.
  • Generics calls are now resolved during lowering/annotation and no longer in codegen.
  • Methods are still defined as structs in the codegen, this will change to behave more like functions

ghaith and others added 30 commits November 21, 2024 11:37
Co-authored-by: Michael <mhasel@users.noreply.github.com>
Use one context per module

Co-authored-by: Michael <mhasel@users.noreply.github.com>
@mhasel mhasel marked this pull request as ready for review January 8, 2025 10:41
@mhasel mhasel marked this pull request as draft January 8, 2025 10:42
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.

3 participants