-
Notifications
You must be signed in to change notification settings - Fork 4
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
Postfix record member access expression #163
Conversation
638c0e2
to
458b76b
Compare
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.
Once again, thank you for supporting the record types. I submitted some changes that I believe can improve the PR even further.
Additionally, if a struct and a union share the same name, such as struct SomeName
and union SomeName
, would there be a collision in the type table?
Right! I haven't thought about that case. I think it needs an extra type check for |
Or maybe we include the "struct " and "union " as the prefix of the id? XD |
Great suggestion! Let me try to implement with this approach. |
5b6fd36
to
a365546
Compare
a365546
to
4b89c79
Compare
4b89c79
to
aea3179
Compare
aea3179
to
fa0edb7
Compare
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.
LGTM! We're moving on to code generation!! Oh yay 🎉
Changes for types
Field
for storing both id andType
for record members.RecordType
for sharing common methods for struct and union.AST
RecordMemExprNode
for postfix record member access expression.Other
InitExprNode
.P.S: I had added additional typecheck tests, but I haven't implemented any code generation for record declaration, so it will throw error
src/qbe_ir_generator.cpp:108: int {anonymous}::PrevExprNumRecorder::NumOfPrevExpr(): Assertion num_of_prev_expr_ != kNoRecord
. I can add additional expression tests after implementing code generation.I can start implementing code generation for struct and union after this PR. 😄