Draft: Add a public list to the Module node
The idea would be to remove all access
attributes from Subroutine
, Function
, GenericProcedure
, Variable
and only use the public
list attribute of Module
.
The motivation is that the public property is really just a property of a module, not the symbols themselves, similarly how subroutine arguments are also just a list of symbols (args
member of Subroutine
).
On the other hand, each variable does have an intent = Local | In | Out | InOut | ReturnVar | External
, and some of these only have meaning inside a subroutine. In the same way access
only has meaning inside a module.
So it is unclear what the best design is, thus I am posting this MR as a Draft, so that we can see.
Note: currently the public
member is constructed by consulting the symbol table and checking the access
member. If we get rid of it, then we have to remember it internally in ast_to_asr
.
The best way to determine which design makes sense is to see how this information would be used in other parts of the compiler. Usually that would be the LLVM backend, but in this case this information is not used in the backend but in error checking when using a module, thus in ast_to_asr
. When checking if the given symbol is private, the easiest seems to be to consult its access
member (i.e., master
), not looking it up in some list (i.e., this MR).