-
Notifications
You must be signed in to change notification settings - Fork 170
Initial support for structs at ASR, LLVM levels. #611
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
Conversation
@certik This is ready. |
@czgdp1807 -- thanks for adding this. 🎉 |
# TODO: the above constructor does not initialize `A` in LPython yet, so | ||
# the below does not work: | ||
#assert x.x == 3 | ||
#assert x.y == 3.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can fix this in a subsequent PR, for now I commented it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look into this tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for implementing this!
I pushed in commits that make it work for CPython as well, and commented out asserts that do not work yet. Apparently dataclasses by default require to provide initialization.
Side notes
While implementing structs I noticed that
python_ast_to_asr.cpp
is not well implemented. Instead of using recursion and visiting the child nodes, they are handled manually. We should improve upon this later.