← 输入框|github.com|刷新
Skip to content

Fix imports when same symbol is imported in different files - #2047

Closed
ubaidsk wants to merge 2 commits into
lcompilers:mainfrom
ubaidsk:fix_imports2
Closed

ubaidsk wants to merge 2 commits into
lcompilers:mainfrom
ubaidsk:fix_imports2

Conversation

@ubaidsk

@ubaidsk ubaidsk commented Jun 27, 2023

Copy link
Copy Markdown
Collaborator

fixes #2032

}
}

std::map<std::string, ASR::TranslationUnit_t*> prev_loaded_modules;

@ubaidsk ubaidsk Jun 27, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It seems we are needing to store already compiled modules. If we compile them again, we get new pointers to the symbols present in that module and this leads to issues/bugs like in #2032.

Here, I declared a global variable. Another approach could be to declare this as a static variable (so that it is shared with other objects) inside CommonVisitor() and then pass it as an argument to load_module().

@ubaidsk
ubaidsk requested a review from certik June 27, 2023 14:51
@certik

certik commented Jun 27, 2023

Copy link
Copy Markdown
Contributor

I would follow this approach: #2049 which cleans up how modules are handled.

@ubaidsk

ubaidsk commented Jun 28, 2023

Copy link
Copy Markdown
Collaborator Author

Closing in favour of #2049.

@ubaidsk ubaidsk closed this Jun 28, 2023
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.

Imports not working

2 participants