You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create a function to automatically compute the value member for an expr node #294
Let's start with make_ImplicitCast_t. Let's create a new function make_ImplicitCast_t_value, that will not accept a value argument, but rather compute it automatically based on the other arguments, and return an ImplicitCast node.
We should probably do this for all expr "make" functions and put this code into libasr, that way it can be shared with LFortran.
I think that will clean up both LFortran and LPython quite a bit, as you wouldn't need to worry about value anymore. LFortran already has all kinds of code to fill in the value attribute, and LPython has replicated quite a bit of this. I think this can be extracted into libasr using the above design, thus simplifying both codes.
@certik There is a question of where to place the new function. For consistency, it should be in the asr.h file and also in the ASR namespace. But to deduce the value of 'value' we need ASRUtils and we cannot include that here since it will be a circular dependency. Any suggestions?
I would put this into ASRUtils into the libasr directory. And then we can use it in the AST to ASR file like any other function from ASRUtils. I would not modify the automatically generated file asr.h at all. Since this has to be written by hand anyway for each node.
Activity
Oshanath commentedon Mar 27, 2022
@certik There is a question of where to place the new function. For consistency, it should be in the asr.h file and also in the ASR namespace. But to deduce the value of 'value' we need ASRUtils and we cannot include that here since it will be a circular dependency. Any suggestions?
certik commentedon Mar 28, 2022
I would put this into ASRUtils into the
libasrdirectory. And then we can use it in the AST to ASR file like any other function from ASRUtils. I would not modify the automatically generated file asr.h at all. Since this has to be written by hand anyway for each node.