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

Refactor: ASR: Handle c_p_pointer() in visit_Call() #2302

Merged
merged 2 commits into from
Aug 27, 2023

Conversation

Shaikh-Ubaid
Copy link
Collaborator

@Shaikh-Ubaid Shaikh-Ubaid commented Aug 26, 2023

This PR removes the use of

is_c_pointer_call_copy = is_c_pointer_call;
visit_expr(...);
if (is_c_pointer_call) {
    ...
}
is_c_pointer_call = is_c_pointer_call_copy;

and handles the c_p_pointer() in visit_Call(),

thus making the code clean/tidy.

Thus remove the is_c_p_pointer_call usage hopefully making code clean
@Shaikh-Ubaid Shaikh-Ubaid changed the title Refactor: Remove use of is_c_pointer_call Refactor: ASR: Handle c_p_pointer() in visit_Call() Aug 26, 2023
bool is_c_p_pointer_call_copy = is_c_p_pointer_call;
ASR::expr_t *value = nullptr;

create_add_variable_to_scope(var_name, type,
Copy link
Collaborator Author

@Shaikh-Ubaid Shaikh-Ubaid Aug 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The c_p_pointer() needs the variable to which it is being assigned. Therefore, in this PR, we first add the variable to scope, then visit the value/c_p_pointer() and later set the variable's initial value (init_val) in process_variable_init_val().

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine, thanks!

@certik certik merged commit d24f131 into lcompilers:main Aug 27, 2023
12 checks passed
@Shaikh-Ubaid Shaikh-Ubaid deleted the asr_refactor_c_p_pointer3 branch August 27, 2023 00:02
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.

2 participants