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

Use replace_regex to replace all occurrences of "." with "/" #1315

Merged

Conversation

Thirumalai-Shaktivel
Copy link
Collaborator

Related: #1305

@Thirumalai-Shaktivel Thirumalai-Shaktivel added the ready for review PRs that are ready for review label Nov 19, 2022
Copy link
Collaborator

@czgdp1807 czgdp1807 left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -3408,7 +3408,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
// Check for the nested modules with "."
// Example: from x.y import z
if (mod_sym.find(".") != std::string::npos) {
mod_sym.replace(mod_sym.find("."), 1, "/");
mod_sym = replace(mod_sym, "[.]", "/");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like this was hard coded before.

Copy link
Collaborator Author

@Thirumalai-Shaktivel Thirumalai-Shaktivel Nov 19, 2022

Choose a reason for hiding this comment

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

Previously, I thought replace() would replace every occurrence in the string. Now, I realize that it replaces only the first occurrence, or simply the index of the find().

@Thirumalai-Shaktivel
Copy link
Collaborator Author

Thanks for the approval. Let's merge this.

@Thirumalai-Shaktivel Thirumalai-Shaktivel merged commit 5a8b50f into lcompilers:main Nov 19, 2022
@Thirumalai-Shaktivel Thirumalai-Shaktivel deleted the nested_modules_03 branch November 19, 2022 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review PRs that are ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants