-
Notifications
You must be signed in to change notification settings - Fork 128
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
Fix deference behavior on mixed subscript and arrow / dot operators #182
base: master
Are you sure you want to change the base?
Conversation
Previously, using subscription operator (literally "[]") with arrow operator (literally "->") or dot operator (literally ".") would cause incorrect dereference result due to inappropriate delayed dereference strategy. In this patch, by adding dereference instructin when encount- ered subscription operator and under correct circumstances fixes the issue.
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.
Clarify the use of "deference" and "dereference" in the wording.
@@ -1260,6 +1260,22 @@ void read_lvalue(lvalue_t *lvalue, | |||
while (lex_peek(T_open_square, NULL) || lex_peek(T_arrow, NULL) || | |||
lex_peek(T_dot, NULL)) { | |||
if (lex_accept(T_open_square)) { | |||
/* if subscripted member's is not yet resolved, deference to resolve |
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.
There should be a comma (,
) appearing right after "e.g.". That is, e.g.,
.
See https://www.scribbr.com/definitions/for-example-abbreviation/
Summary by Bito
This pull request fixes a double free error in the globals file and enhances type safety in the parser by changing variable types from int to bool. It also introduces new tests for dynamic data structures, focusing on mixed subscript and arrow/dot operators to improve code reliability and safety.Unit tests added: True
Estimated effort to review (1-5, lower is better): 2